解决方案 »

  1.   

    换种方式改颜色就行了,像这样
        if (status) {
            mlbText.shadowColor= [UIColor orangeColor];
            [mlbText setAttributedText:[[NSAttributedString alloc] initWithString:mlbText.text attributes:@{NSForegroundColorAttributeName: [UIColor redColor]}]];    }
        else {
            mlbText.shadowColor= [UIColor whiteColor];
            [mlbText setAttributedText:[[NSAttributedString alloc] initWithString:mlbText.text attributes:@{NSForegroundColorAttributeName: [UIColor darkGrayColor]}]];
        }另外你按钮点击事件把按钮直接传进去,按钮本身有个属性可以记录状态的,你就不用自己再定义一个bool变量来存状态了
    btn.selected
    这个可以直接用,还可以根据这个状态设置按钮的不同样式