user4951
user4951

Reputation: 33090

How can I change the font without changing the size?

[[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?

Upvotes: 1

Views: 189

Answers (1)

epetousis
epetousis

Reputation: 454

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.

Upvotes: 1

Related Questions