本文介绍了在iOS 7中设置NavigationBar Tint Color的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在iOS 7中为我的appdelegate设置所有导航栏的色调。这总是在以前工作,但由于某些原因,现在没有任何变化。在我的appDelegate的didFinishLaunching部分,我有:

Am trying to set the tint for all navigation bars from my appdelegate in iOS 7. This worked always before, but for some reason now, nothing is changing. In the didFinishLaunching part of my appDelegate I have:

[[UINavigationBar appearance] setTintColor:toolbarcolor];

但是,栏保持默认的半透明选项。

However, the bar stays the default translucent option.

推荐答案

您可以使用属性:

[[UINavigationBar appearance] setBarTintColor:[UIColor purpleColor]];

如果您还不希望导航栏为半透明,则可以设置属性NO。

If you also don't want the navigation bar to be translucent, you can set the translucent property to NO.

不幸的是,半透明属性在UINavigationBar外观代理上不可用,因此您必须单独设置此属性(在故事板,.xib中或像控制器中的viewDidLoad。)

Unfortunately, the translucent property is not available on the UINavigationBar appearance proxy, so you will have to set this property individually (in your storyboard, .xib, or in something like viewDidLoad in your controller).

这篇关于在iOS 7中设置NavigationBar Tint Color的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 19:38