Search code examples
iosuinavigationcontrolleruinavigationitemuiappearancetintcolor

iOS How To Keep Navigation Item Color From Changing When Global Tint Color Set?


In iPhone and iOS 9.0, I am seeing something weird with the global tint color vs specific colors being set.

After setting the following code in the AppDelegate, the navigation item color changes after showing an alert.

    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()

I want the navigation item color to keep the color I set. (Colors and screen shots are from a temp app I created to show the problem.)

Notice below how the "Home" Navigation Item changes to green which is the global tint color set in the App Delegate.

Home Screen

First One

Second One

Alert Launched

First One With Changed Navigation Item Color

Why did "Home" change to green? How to keep it from doing that?

Code is here: https://bitbucket.org/finneycanhelp/tintcolorwhat


Solution

  • Setting the global tint color using the storyboard and not programmatically seems like a viable solution.