Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS - Globally change navigation bar title color using appearance?

Tags:

This crashes the app:

[[UINavigationBar appearance] setTitleColor:[UIColor darkGrayColor] forState:UIControlStateNormal]; 

Is there a way to do this using appearance?

like image 474
RyJ Avatar asked Jun 12 '12 20:06

RyJ


People also ask

How do I change the navigation bar on my Iphone?

A user changes the navigation bar's style, or UIBarStyle , by tapping the “Style” button to the left of the main page. This button opens an action sheet where users can change the background's appearance to default, black-opaque, or black- translucent.


1 Answers

This worked:

NSDictionary *textTitleOptions = [NSDictionary dictionaryWithObjectsAndKeys:[UIColor darkGrayColor], UITextAttributeTextColor, [UIColor whiteColor], UITextAttributeTextShadowColor, nil]; [[UINavigationBar appearance] setTitleTextAttributes:textTitleOptions]; 
like image 53
RyJ Avatar answered Dec 18 '22 11:12

RyJ