user2924482
user2924482

Reputation: 9120

UINavigationBar: Changing the font programmatically

I'm implementing a UINavigationBar with some text on it but I want to change the font in the UINavigationBar text any of you knows if is posible to change font in the text programmatically?

I'll really appreciate your help

Upvotes: 1

Views: 93

Answers (1)

Maulik shah
Maulik shah

Reputation: 1704

From iOS 7 and later:

 NSShadow* shadow = [NSShadow new];
    shadow.shadowOffset = CGSizeMake(0.0f, 1.0f);
    shadow.shadowColor = [UIColor redColor];
    [[UINavigationBar appearance] setTitleTextAttributes: @{
         NSForegroundColorAttributeName: [UIColor greenColor],
                    NSFontAttributeName: [UIFont fontWithName:@"Helvetica" size:20.0f],
                  NSShadowAttributeName: shadow
                                                          }];

Upvotes: 1

Related Questions