iOS - Globally change navigation bar title color using appearance? iOS - Globally change navigation bar title color using appearance? ios ios

iOS - Globally change navigation bar title color using appearance?


This worked:

NSDictionary *textTitleOptions = [NSDictionary dictionaryWithObjectsAndKeys:[UIColor darkGrayColor], UITextAttributeTextColor, [UIColor whiteColor], UITextAttributeTextShadowColor, nil];[[UINavigationBar appearance] setTitleTextAttributes:textTitleOptions];


Here's an example of how to do this in Swift:

UINavigationBar.appearance().titleTextAttributes =  [NSFontAttributeName:UIFont(name:"Exo2-Bold", size: 18) as! AnyObject,  NSForegroundColorAttributeName:UIColor.whiteColor()]


That crashes the app before UINavigationBar doesn't have a title or state... Those are UIButton methods

You need

[[UINavigationBar appearance] setTintColor:[UIColor darkGrayColor]];