Take the 2-minute tour ×

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.

share|improve this question
add comment

4 Answers

up vote 31 down vote accepted

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).

[[UINavigationBar appearance] setTitleTextAttributes: 
    [NSDictionary dictionaryWithObjectsAndKeys: 
        [UIColor blackColor], UITextAttributeTextColor, 
           [UIFont fontWithName:@"ArialMT" size:16.0], UITextAttributeFont,nil]];

The below tutorial is the best tutorial for customization of UIElements like UInavigation bar, UIsegmented control, UITabBar. This may be helpful to you


share|improve this answer
On iOS 7 the UITextAttributeFont is deprecated –  rolandjitsu Dec 12 '13 at 23:01
@rolandjitsu you just have to use NSFontAttributeName instead of UITextAttributeFont. –  CedricSoubrie Dec 19 '13 at 23:57
@CedricSoubrie ~ yes, that is true, just wanted to inform the author about that so we can have an updated answer :) –  rolandjitsu Dec 20 '13 at 19:08
And UITextAttributeTextColor should be replaced with NSForegroundColorAttributeName –  bobmoff Mar 4 at 8:25
add comment

Just put this in your app delegate's


From Ray Wenderlich:


[[UINavigationBar appearance] setTitleTextAttributes:
[NSDictionary dictionaryWithObjectsAndKeys:
[UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.8], 
[NSValue valueWithUIOffset:UIOffsetMake(0, -1)], 
[UIFont fontWithName:@"STHeitiSC-Light" size:0.0], 
UITextAttributeFont, nil]];
share|improve this answer
Dont set size 0 to your font, that will cause visual errors when you push to a view controller. First when you push the font will have size 0 and then it will size itself appropriately but it still is visible -and annoying. Set it to 18.0 –  matejkramny Aug 9 '12 at 20:45
add comment

(This is not possible using the new iOS 5.0 Appearance API).


iOS >= 5.0 :

Set the Title Text Attributes for the Navigationbar:

// Customize the title text for *all* UINavigationBars
NSDictionary *settings = @{
    UITextAttributeFont                 :  [UIFont fontWithName:@"YOURFONTNAME" size:20.0],
    UITextAttributeTextColor            :  [UIColor whiteColor],
    UITextAttributeTextShadowColor      :  [UIColor clearColor],
    UITextAttributeTextShadowOffset     :  [NSValue valueWithUIOffset:UIOffsetZero]};

[[UINavigationBar appearance] setTitleTextAttributes:settings];

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)

UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 200, 44)];
label.font = [UIFont fontWithName:@"YOURFONTNAME" size:20.0];
label.shadowColor = [UIColor clearColor];
label.textColor =[UIColor whiteColor];
label.text = self.title;  
self.navigationItem.titleView = label;      
[label release];
share|improve this answer
You can actually use [UINavigationBar appearance] to customize the appearance of text on the navBar iOS 5+ You just need to do it in your app delegate, i.e. before your view controller appears. –  stalinkay Jun 24 '12 at 11:45
Indeed, thank you for the comment. I couldn't find it at the time. –  Tieme Dec 28 '12 at 14:48
add comment

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.

share|improve this answer
add comment

Your Answer


