23
votes

I've implemented a Navigation Controller for my View Controller with storyboard. Now i want changing navigation bar title font and size with Attribute Inspector but it doesn't work and i don't understand why. Title color changes but font dont.

ps: the color changing is visible only at runtime and not in the storyboard.

Attribute Inspector's properties

3
maybe because font size is set to 0.0? :) What's the point of this value? - kambala
I can't believe that! Thank you - Andorath
having a similar problem, I'm able to make the changes but they don't show up when I run the app.. :-/ - user1940321

3 Answers

30
votes

You need to select navigation Bar and then you can set relevant properties. Please check attached image. It might help you.

enter image description here

28
votes

When I tried to set the font, my font field was grayed out. But all I needed to do was change type to System and then again to Custom. It worked:-) Now I can choose my custom font

3
votes

For me Bartłomiej Semańczyk's change to system font & change back trick only works to set the font to a particular system-included font. For custom fonts that I've added, the font face gets set to my custom font but it always gets displayed as size ~16 or so regardless of what size I select in the storyboard.

So the best way I can find to do this is to set self.navigationController.navigationBar.titleTextAttributes in the view controller's viewDidLoad method.

Note that you don't need to do this in every view controller you push onto this navigation stack, just the first one that gets displayed since it sets the property on the navigationBar itself not on the navigationItem. If you're subclassing UINavigationController already, that's the most logical place to set this but I'd rather not subclass it just for this one line change.