I have an UINavigationBar added to my UIViewController view. I want to change the fonts properties. Note that I want to change a UINavigationBar not controller. In my app where I use UINavigationController I use self.navigationItem.titleView = label;
to display the custom label.
How can I accomplish to have a custom title in my UINavigationBar?
P.S I use this to set the title text self.navBar.topItem.title = @"Information";
of my UINavigationBar.
In iOS8 swift, use the following code to set font:
Don't forget to add the font to your target.
I did everything that can be done about a font and I couldn't load it, when , in fact the font wasn't a member of my target.
So check Target Membership as well on the custom font added.
From iOS 5 onwards we have to set title text color and font of navigation bar using titleTextAttribute Dictionary(predefined dictionary in UInavigation controller class reference).
The below tutorial is the best tutorial for customization of UIElements like UInavigation bar, UIsegmented control, UITabBar. This may be helpful to you
link below will help you. It depends on where would you like to set font properties on current viewController's navigation bar all anywhere in application
you can find nice tutorial here% http://www.appcoda.com/customize-navigation-status-bar-ios-7/?utm_campaign=iOS_Dev_Weekly_Issue_118&utm_medium=email&utm_source=iOS%2BDev%2BWeekly
The basic idea is to create NSDictionary instance and fill it with your desired font and other properties. I finished with this solution:
in your -viewDidLoad controller method after [super viewDidLoad] put this lines:
(This is not possible using the new iOS 5.0 Appearance API).Edit:
iOS >= 5.0 :
Set the Title Text Attributes for the Navigationbar:
iOS < 5.0
UINavigationItem doesn't have a property called label or something, only a titleView. You are only able to set the font by setting a custom label as this title view You could use the following code: (as suggested here)
Just put this in your app delegate's
From Ray Wenderlich:
http://www.raywenderlich.com/4344/user-interface-customization-in-ios-5