Set NavigationBar Tint Color in iOS 7

user717452 picture user717452 · Oct 22, 2013 · Viewed 9.4k times · Source

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.

Answer

Greg picture Greg · Oct 22, 2013

You can set the bar tint color using the barTintColor property:

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

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

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