Reputation: 181
How do I change the colour of the UINavigationItem from black to white?
I have tried the following in my LHAppDelegate.m:
[[UINavigationBar appearance] setTintColor:UIColorFromRGB(0xFFFFFF)];
[[UINavigationBar appearance] setBarTintColor:[UIColor greenColor]];
changes the whole bar to green, I am trying to change the colour of the black text 'Update Tasks'
Upvotes: 1
Views: 977
Reputation: 31647
If you want to have a solid color for your navigation bar in iOS 6 similar to iOS 7 use this:
[[UINavigationBar appearance] setBackgroundImage:[[UIImage alloc] init] forBarMetrics:UIBarMetricsDefault];
[[UINavigationBar appearance] setBackgroundColor:[UIColor greenColor]];
in iOS 7 use the barTintColor
like this:
navigationController.navigationBar.barTintColor = [UIColor greenColor];
or
[[UINavigationBar appearance] setBarTintColor:[UIColor greenColor]];
To update the text color, use below.
[[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor whiteColor]}];
Upvotes: 2