【发布时间】:2013-10-02 12:22:36
【问题描述】:
我想将导航栏的背景设置为黑色,并将其中的所有颜色设置为白色。
所以,我使用了这段代码:
[[UINavigationBar appearance] setTitleTextAttributes:
[NSDictionary dictionaryWithObjectsAndKeys:
[UIColor whiteColor],
NSForegroundColorAttributeName,
[UIColor whiteColor],
NSForegroundColorAttributeName,
[NSValue valueWithUIOffset:UIOffsetMake(0, -1)],
NSForegroundColorAttributeName,
[UIFont fontWithName:@"Arial-Bold" size:0.0],
NSFontAttributeName,
nil]];
但是后退按钮文字颜色、箭头和条形按钮仍然有默认的蓝色。
如何更改如下图所示的颜色?
【问题讨论】:
-
在 AppDelegate 中尝试 if ([self.window respondsToSelector:@selector(setTintColor:)]) self.window.tintColor = [UIColor whiteColor];
-
有趣的是,您的代码对我来说效果很好(只是想将文本颜色更改为白色)。谢谢!
-
您使用的蓝色是什么颜色?看起来不错!
-
@ebi 有些人不喜欢分享。只需使用颜色选择器来挑选它。或者....你去:RGB:(18、60、133)
标签: iphone ios objective-c uinavigationbar ios7