Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Navigation bar different color in iOS7?

I am creating an iPhone app, but my navigation bar has a different color in each view?

I am developing for iOS7 and with Xcode 5.

I have tried to programatically make the navigation bar the same by writing this in the AppDelegate.m file:

[[UINavigationBar appearance] setBarStyle:UIBarStyleBlackTranslucent];

What should I be doing?

like image 970
Tobias Lindgreen Avatar asked Sep 15 '13 11:09

Tobias Lindgreen


1 Answers

NavigationBar style is Translucent light (default) or translucent dark. By default, the translucent property is YES, set it to NO and use barTintColor property of navigationbar to set the navbar background with some colour.

Objective-C

self.navigationController.navigationBar.barTintColor = [UIColor whiteColor];
self.navigationController.navigationBar.translucent = NO;

Swift 3

navigationController?.navigationBar.barTintColor = UIColor.white
navigationController?.navigationBar.isTranslucent = false
like image 185
Suhit Patil Avatar answered Sep 28 '22 11:09

Suhit Patil