【发布时间】:2013-06-01 00:03:27
【问题描述】:
我有一个条形按钮项,仅用于显示在屏幕上执行某些操作时更新的字符串。我已将文本颜色设置为白色。但是,它以灰色显示在屏幕上。无论我将文本更改为哪种颜色,我仍然会得到浅灰色而不是所需的颜色。为什么我没有得到正确的颜色?这是我缺少的属性吗?
UIColor *buttonColor = [UIColor colorWithRed:255.0/255.0 green:255.0/255.0 blue:255.0/255.0 alpha:1.0];
_timeButton.title = [NSString stringWithFormat:@"Updated at: %@",dateString];
[_timeButton setStyle:UIBarButtonItemStylePlain];
_timeButton.tintColor = [UIColor clearColor];
[_timeButton setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
[UIFont boldSystemFontOfSize:15], UITextAttributeFont,
buttonColor ,UITextAttributeTextColor,
nil]
forState:UIControlStateNormal];
【问题讨论】:
-
感谢您的链接。但是,该线程中的任何内容都与在普通栏按钮项上设置文本无关。我的问题是我的文字不是 [UIColor colorWithRed:255.0/255.0 green:255.0/255.0 blue:255.0/255.0 alpha:1.0];但更接近 [UIColor colorWithRed:255.0/255.0 green:255.0/255.0 blue:255.0/255.0 alpha:.5];我想要后者。
标签: ios uibarbuttonitem uitoolbar