Praveen Kumar
Praveen Kumar

Reputation: 567

Can't set font for Navigation Bar in Storyboard of Xcode

I cannot set font for Navigation Bar in my NavigationController using story board. I checked some questions here. They told options to change the font available in Attributes Inspector. But when I checked there I can't select custom fonts for my NavigationBar. You can see that in below screen shot.

enter image description here

You can see the Font Family field is disabled. So please help me to change the Navigation Bar font from story board. Thanks in advance.

Upvotes: 4

Views: 919

Answers (2)

Mrsantateam
Mrsantateam

Reputation: 171

You can add custom font with code if you want that font in all project just add it to didFinishLaunchingWithOptions

[[UINavigationBar appearance] setTitleTextAttributes: [NSDictionary dictionaryWithObjectsAndKeys:
                                                      [UIColor colorWithRed:245.0/255.0 green:245.0/255.0 blue:245.0/255.0 alpha:1.0], NSForegroundColorAttributeName,
                                                      [UIFont fontWithName:@"fontname" size:24.0], NSFontAttributeName, nil]];

Upvotes: 2

J Manuel
J Manuel

Reputation: 3070

Just change Custom to System and change again to Custom. Im not sure why, but this worked for me!

Upvotes: 14

Related Questions