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?
let navigation = UINavigationBar. appearance() let navigationFont = UIFont(name: "Custom_Font_Name", size: 20) let navigationLargeFont = UIFont(name: "Custom_Font_Name", size: 34) //34 is Large Title size by default navigation. titleTextAttributes = [NSAttributedStringKey. foregroundColor: UIColor.
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...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With