[[UINavigationBar appearance] setTitleTextAttributes:
@{UITextAttributeTextColor: navTextColor,
UITextAttributeTextShadowColor: navTextColor,
UITextAttributeTextShadowOffset: [NSValue valueWithUIOffset:UIOffsetMake(0, 0)],
UITextAttributeFont: [UIFont fontWithName:@"HelveticaNeue-Bold" size:12]}];
That code changes the UINavigationBar's font to HelveticaNeue-Bold and set the size to 12.
What about if I do not want to set the size to 12. I just want the font to be HelveticaNeue
What should I do?
You can get the font size by using titleTextAttributes, an NSDictionary on the UINavigationBar just added to iOS 5. Then just call [navibar.titleTextAttributes objectForKey:UITextAttributeFont];
to get the UIFont of the title.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.