简体   繁体   English

iOS5 UITabBar更改…更多导航控制器的颜色

[英]iOS5 UITabBar change the color of the …More navigation controller

I'm trying to make my app feel more customized with a shaded navigation bar. 我试图通过阴影导航栏使我的应用程序更具个性化。 For all controllers that I create, I can change the color of the navbar using: 对于我创建的所有控制器,我可以使用以下命令更改导航栏的颜色:

self.navigationController.navigationBar.tintColor = [UIColor blackColor];

So all of my controllers use black navigation bars. 因此,我所有的控制器都使用黑色导航栏。 However, when such controller is viewed in the " ...More " tabbar section, the tint reverts to blue . 但是,当在“ ...更多 ”标签栏区域中查看此类控制器时, 色调将恢复为蓝色

How do I change the ...More navigation controller tint? 如何更改...更多导航控制器的色调?

As a side note, how do I would I go about globally define the style that my app is using? 附带说明一下,我将如何全局定义应用程序正在使用的样式?

edit: To save some work, I defined a custom MyColors class, and put these methods in it: 编辑:为了节省一些工作,我定义了一个自定义MyColors类,并将以下方法放入其中:

+(UIColor*)navBarColor;
+(UIColor*)toolBarColor;
+(UIColor*)lightFontColor;
+(UIColor*)darkFontColor;
+(UIColor*)transparentColor;

This will help me change the colors of a UITabBar in the future without having to go hunting through each UIViewController and changing the color by hand! 这将帮助我将来更改UITabBar的颜色,而不必遍历每个UIViewController并手动更改颜色!

Thank you! 谢谢!

If you want to set a global color then use the new appearance proxy. 如果要设置全局颜色,请使用新的外观代理。

for example, 例如,

[[UINavigationBar appearance] setTintColor:myColor];

Any UIKit object that adopts the UIAppearence protocol can be set globally like this. 可以像这样全局设置任何采用UIAppearence协议的UIKit对象。

self.moreNavigationController.navigationBar.tintColor = [UIColor blackColor];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM