Reputation: 5424
I have made a subclass for UINavigationController where i change the colors of the bar.
- (void)viewDidLoad {
[super viewDidLoad];
self.navigationBar.barTintColor = [StyleKit2 blue];
self.navigationBar.tintColor = [UIColor whiteColor];
}
The barTintColor is changed to blue, but the Title text is not changed to white. TintColor should affect all the items in the bar?
What am i doing wrong
Upvotes: 0
Views: 183
Reputation: 3590
The tintColor
is used to tint of the navigation bar items, the barTintColor
is used to tint the background, but in order to tint the title, you have to use setTitleTextAttributes
.
self.navigationController.navigationBar.barTintColor = [StyleKit2 blue];
self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
[self.navigationController.navigationBar
setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor whiteColor]}];
More information about it:
Upvotes: 2