mvasco
mvasco

Reputation: 5101

Navigation Bar title font does not change

Following another SO question, I am trying to change the navigationBar title font using the following piece of code in the viewDidLoad method:

  NSShadow *shadow = [[NSShadow alloc] init];
    shadow.shadowColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.8];
    shadow.shadowOffset = CGSizeMake(0, 1);
    [[UINavigationBar appearance] setTitleTextAttributes: [NSDictionary dictionaryWithObjectsAndKeys:
                                                           [UIColor colorWithRed:21.0/255.0 green:62.0/255.0 blue:111.0/255.0 alpha:1.0], NSForegroundColorAttributeName,
                                                           shadow, NSShadowAttributeName,
                                                           [UIFont fontWithName:@"HelveticaNeue-CondensedBlack" size:21.0], NSFontAttributeName, nil]];

But the font is not changing.

Can you please tell me what is wrong there?

Upvotes: 0

Views: 265

Answers (1)

Undo
Undo

Reputation: 25697

You can't change UIAppearance attributes anywhere outside of applicationDidFinishLaunching: in your App Delegate. UIAppearance is designed to be changed when the app starts.

If you move it to applicationDidFinishLaunching: in your delegate it should work.

Upvotes: 1

Related Questions