UINavigationBar change title text color and font size
ios7, iphone-5, uinavigationbar
Solution
Apply Attributes to Navigationcontroller instance.
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7")) {
NSDictionary *navbarTitleTextAttributes = [NSDictionary dictionaryWithObjectsAndKeys:
[UIColor whiteColor],
NSForegroundColorAttributeName,
[UIFont fontWithName:@"MyFavoriteFont" size:20.0],
NSFontAttributeName,
nil];
[self.transitionNavController.navigationBar setTitleTextAttributes:navbarTitleTextAttributes];
}
Hope this helps...
Problem
I want to change navigation title's font and color..so, for that i've done this below code..but its not working... ``` if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7")) { NSDictionary *navbarTitleTextAttributes = [NSDictionary dictionaryWithObjectsAndKeys: [UIColor whiteColor], NSForegroundColorAttributeName, [UIFont fontWithName:@"MyFavoriteFont" size:20.0], NSFontAttributeName, nil]; [[UINavigationBar appearance] setTitleTextAttributes:navbarTitleTextAttributes]; NSLog(@"setTitleTextAttributes"); } ``` why this code is not working?