iOS如何在全局色调颜色设置时保持导航项颜色不变?

时间:2015-10-16 10:04:50

标签: ios uinavigationcontroller uinavigationitem uiappearance tintcolor

在iPhone和iOS 9.0中,我看到了全局色调与特定颜色设置的奇怪之处。

在AppDelegate中设置以下代码后,导航项颜色会在显示警报后更改。

    window!.tintColor = UIColor.greenColor()

    // per docs "The tint color to apply to the navigation items and bar button items."
    UINavigationBar.appearance().tintColor = UIColor.redColor()

    UITabBar.appearance().tintColor = UIColor.yellowColor()

我希望导航项颜色能够保持我设置的颜色。 (颜色和屏幕截图来自我创建的临时应用程序以显示问题。)

请注意下面“主页”导航项如何变为绿色,这是应用程序代表中设置的全局色调颜色。

Home Screen

First One

Second One

Alert Launched

First One With Changed Navigation Item Color

为什么“Home”变为绿​​色? 如何防止这样做?

代码在这里:https://bitbucket.org/finneycanhelp/tintcolorwhat

1 个答案:

答案 0 :(得分:0)

使用故事板而不是以编程方式设置全局色调颜色似乎是一个可行的解决方案。

相关问题