这是一个愚蠢的问题,但我真的很想知道,如何在我的默认 UINavigationBar
中添加自定义颜色,它实际上是从 Editor 添加到我的
> viewController
嵌入
> NavigationController
。
我添加这个:
[[UINavigationBar appearance] setTintColor:[UIColor colorWithRed:244/255 green:119/255 blue:39/255 alpha:1.0]];
在我的 AppDelegat
中,在 didFinishLaunchingWithOptions
中,但没有任何反应。谁能告诉我该怎么做?
非常感谢。
最佳答案
在您的 View Controller 中,将此添加到您的 viewDidLoad
方法中:
[[[self navigationController] navigationBar] setBarTintColor:[UIColor yourColor];
如果您的导航 Controller 是您的 Root View Controller ( Storyboard 中的第一个 View Controller ),您可以在应用委托(delegate)中使用它:
[[(UINavigationController*)self.window.rootViewController navigationBar] setBarTintColor:[UIColor yourColor]];
关于ios - Storyboard中带有嵌入式导航 Controller 的 UINavigationBar 自定义颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28781555/