I am trying to customize the navigationBar of a navigation controller in iOS7 and the title color is not changing. I am doing the following:
[navigationController.navigationBar setBarTintColor:[UIColor colorWithRed:46.0f/256.0f green:46.0f/256.0f blue:46.0f/256.0f alpha:1]];
[navigationController.navigationBar setTranslucent:NO];
[navigationController.navigationBar setTitleTextAttributes:@{[UIColor whiteColor]:UITextAttributeTextColor}];
[self presentViewController:navigationController animated:YES completion:nil];
The navigationBar translucency gets turned off and it is dark, but the title also stays dark. I've also tried to create a custom label and set it as the title view with not much luck.
How can the title color be changed?
Best Answer
The appearance api continues to evolve, and UITextAttributeTextColor is now replaced with NSForegroundColorAttributeName.
I'll add two things:
The key comes first, then the object.
If you want to globally change your nav controller's title attributes, use the appearance api:
I'd put that appearance api call in your app delegate's didFinishLaunchingWithOptions method.
UPDATE: Might as well post the Swift equivalents.
To update the navigationBar for an individual view controller, one can use:
To change the navigation bar's appearance throughout an entire app, one can use: