How to change colour of UINavigationBar

By default the UINavigationBar on an iOS app is blue. Apple have some built-in styles that you can use

[self.navigationController.navigationBar setBarStyle:UIBarStyleBlackOpaque];

The options available are:

  • UIBarStyleBlack
  • UIBarStyleBlackOpaque
  • UIBarStyleBlackTranslucent
  • UIBarStyleDefault

*UIBarStyleBlackOpaque and UIBarStyleTranslucent have been depreciated. You should use UIBarStyleBlack and set property ‘translucent’ to yes if needed*.

You can also change the colour to any colour you wish using one of the two lines of codes below and adjusting the colour values.

self.navigationController.navigationBar.tintColor = [UIColor colorWithRed:.7 green:.5 blue:.2 alpha:1];
 
self.navigationController.navigationBar.tintColor = [UIColor blackColor];

Leave a Comment