我面临一个奇怪的问题。我正在更改突出显示时按钮的文本颜色,但在视觉上没有任何变化。
[myButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[myButton setTitleColor:[UIColor colorWithRed:150.0 green:150.0 blue:150.0 alpha:1.0] forState:UIControlStateHighlighted];
我错过了什么吗?
答案 0 :(得分:72)
尝试:
[myButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[myButton setTitleColor:[UIColor colorWithRed:150.0/256.0 green:150.0/256.0 blue:150.0/256.0 alpha:1.0] forState:UIControlStateHighlighted];
颜色成分浮动在0.0到1.0之间!