I want to change the color of the navigation bar color, but I\'m not sure whether or not I should change the tint or the background. I know iOS 7 is going for a more flat de
One more thing, if you want to change the navigation bg color in UIPopover you need to set barStyle
to UIBarStyleBlack
if([UINavigationBar instancesRespondToSelector:@selector(barTintColor)]){ //iOS7
navigationController.navigationBar.barStyle = UIBarStyleBlack;
navigationController.navigationBar.barTintColor = [UIColor redColor];
}
The behavior of tintColor for bars has changed on iOS 7.0. It no longer affects the bar's background and behaves as described for the tintColor property added to UIView. To tint the bar's background, please use -barTintColor.
navController.navigationBar.barTintColor = [UIColor navigationColor];
Insert the below code in didFinishLaunchingWithOptions() in AppDelegate.m
[[UINavigationBar appearance] setBarTintColor:[UIColor
colorWithRed:26.0/255.0 green:184.0/255.0 blue:110.0/255.0 alpha:1.0]];
The background color property is ignored on a UINavigationBar
, so if you want to adjust the look and feel you either have to use the tintColor
or call some of the other methods listed under "Customizing the Bar Appearance" of the UINavigationBar class reference (like setBackgroundImage:forBarMetrics:
).
Be aware that the tintColor
property works differently in iOS 7, so if you want a consistent look between iOS 7 and prior version using a background image might be your best bet. It's also worth mentioning that you can't configure the background image in the Storyboard, you'll have to create an IBOutlet
to your UINavigationBar
and change it in viewDidLoad
or some other appropriate place.