How to set the colour in a UINavigationBar

Since Xcode 5 and iOS 7 the default appearance of a UINavigationBar is black translucent. This even affects the same app running in iOS 6. Black opaque is deprecated and can no longer be set in Interface Builder.

However, you can set the appearance for all nav bars by putting this little gem in your App Delegate’s didFinishLaunchingWithOptions method:

[[UINavigationBar appearance] setTintColor:[UIColor blackColor]];

You can specify colours other than black.

Note that iOS 7 devices are affected differently by this change: only the icon/text colour will change into your specified colour, but the bar itself will remain translucent. Using black means text buttons are barely readable. Hence, a version check would be appropriate:

    // changes the colour of all navigation bars on iOS 6 and lower
    if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) {
        [[UINavigationBar appearance] setTintColor:[UIColor blackColor]];
    }




Jay is the CEO and founder of WP Hosting, a boutique style managed WordPress hosting and support service. He has been working with Plesk since version 9 and is a qualified Parallels Automation Professional. In his spare time he likes to develop iOS apps and WordPress plugins, or draw on tablet devices. He blogs about his coding journey at http://wpguru.co.uk and http://pinkstone.co.uk.