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?
Behavior from some of the properties of UINavigationBar
has changed from iOS 7. You can see in the image shown below :
Two beautiful links I'd like to share with you. For more details you can go through these links :
Apple Documentation for barTintColor says :
This color is made translucent by default unless you set the translucent property to NO.
Sample Code :
self.navigationController.navigationBar.barTintColor = [UIColor blackColor];
self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
[self.navigationController.navigationBar
setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor whiteColor]}];
self.navigationController.navigationBar.translucent = NO;