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?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With