This crashes the app:
[[UINavigationBar appearance] setTitleColor:[UIColor darkGrayColor] forState:UIControlStateNormal];
Is there a way to do
Using modern syntax and code that actually runs, this is how to globally style your UINavigationBar
title text:
NSShadow *navigationBarTitleShadow = [[NSShadow alloc] init];
navigationBarTitleShadow.shadowColor = [UIColor colorWithWhite:0.5
alpha:0.5];
navigationBarTitleShadow.shadowOffset = CGSizeMake(2.0, 2.0);
[[UINavigationBar appearance] setTitleTextAttributes:@{ NSForegroundColorAttributeName : [UIColor blackColor],
NSFontAttributeName : [UIFont fontWithName:@"Arial-BoldMT"
size:30.0],
NSShadowAttributeName : navigationBarTitleShadow }];
Note: NSShadow
's shadowBlurRadius
property is not respected.
Note: Shadows are so iOS 6. Don't ever use them.