I want to set background for Navigation Bar to be black and all colors inside it to be white.
So, I used this code :
[[UINavigationBar appearance] setTitleTextAttributes:
[NSDictionary dictionaryWithObjectsAndKeys:
[UIColor whiteColor],
NSForegroundColorAttributeName,
[UIColor whiteColor],
NSForegroundColorAttributeName,
[NSValue valueWithUIOffset:UIOffsetMake(0, -1)],
NSForegroundColorAttributeName,
[UIFont fontWithName:@"Arial-Bold" size:0.0],
NSFontAttributeName,
nil]];
But back button text color, arrow and bar button have still default blue color.
How to change those colors like on image below?
Swift / iOS8
If you're looking to change the title text size and the text color you have to change the NSDictionary titleTextAttributes, for 2 of its objects:
Swift3, ios 10
To globally assign the color, in AppDelegate
didFinishLaunchingWithOptions
:Swift 4, iOS 11
I think previous answers are correct , this is another way of doing the same thing. I am sharing it here with others just in case if it becomes useful for someone. This is how you can change the text/title color for the navbar in ios7:
It seems that
Accessibility
controls in theiOS Settings
override pretty much everything you try to do color-wise to the navigation bar buttons. Make sure you have all the settings to the default positions (set increase contrast, bold text, button shapes, etc to off) otherwise you won't see anything change. Once I did it, all the color change code started working as expected. You might not need to turn them all off, but I didn't pursue it further.