UIButton 文本颜色在 ios7 中的选择中正在更改



我在 IB 中创建了一个UIButton,我正在使用NSAttributedString.设置标题

NSMutableAttributedString *att = [[NSMutableAttributedString alloc] initWithString:@"skip" attributes:@{NSForegroundColorAttributeName: [UIColor redColor]}];
[self.skipB setAttributedTitle:att forState:UIControlStateNormal];

现在通常(<ios7)当我只为状态UIControlStateNormal设置某些内容时,它将为所有状态默认设置,因此没有选择或突出显示的状态,单击按钮时可能会更改文本的颜色。但是,在ios7中运行时,当您单击按钮时,文本将改变颜色,就像在其上放置浅白色蒙版一样。我希望它不会改变颜色。我很可能错过了设置一些应该很明显的东西,但是还有其他人在ios7上看到过吗?>

希望这个帮助

NSMutableAttributedString *att = [[NSMutableAttributedString alloc] initWithString:@"skip" attributes:@{NSForegroundColorAttributeName: [UIColor redColor]}];[self.skipB setAttributedTitle:att forState:UIControlStateNormal];

[self.skipB setAttributedTitle:att forState:UIControlStateSelected];

最新更新