1

I have succesfully change the navbar button with this:

[[UINavigationBar appearance] setBarTintColor:[UIColor colorWithRed:26.0/255 green:132.0/255 blue:182.0/255 alpha:.5]];

What about if I want to change the color of the title (from black) or the color of the button?

enter image description here

user4951
  • 32,206
  • 53
  • 172
  • 282
  • The button color can you change by setting the tint color of the navigationbar – Gustaf Rosenblad May 28 '14 at 07:16
  • And you can change the titleColor by setting the titleTextAttributes property – Gustaf Rosenblad May 28 '14 at 07:18
  • You may take help from the following link-here [1]: http://stackoverflow.com/questions/10430298/how-to-set-font-color-of-the-title-in-uinavigationbar-using-ios5-appearance-ap – SilentStalker May 28 '14 at 07:25
  • @SilentStalker the answer in that link is now using deprecated code. – Fogmeister May 28 '14 at 07:27
  • Why I cannot add image to my question like usual? I tried to add https://www.evernote.com/shard/s209/sh/c3720f97-38da-4d85-86e1-dd5b95a2d679/b4cbf9106654d1872834a19d7ccdbb68/res/83eb1c65-1530-4d7f-a490-f6dd0bc15479/skitch.png?resizeSmall&width=832 – user4951 May 28 '14 at 07:31

2 Answers2

2

This is what I have in my App Delegate in a method specially for changing appearances.

// set button tint colour to white
[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];

// set the bar tint colour to purplish
[[UINavigationBar appearance] setBarTintColor:[UIColor colorWithRed:.2 green:.458823529 blue:.592156863 alpha:1.0]];

// set title text label colour to white
[[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor whiteColor]}];
Fogmeister
  • 76,236
  • 42
  • 207
  • 306
1

For navigation bar title color in iOS7 you should use the setTitleTextAttributes of UINavigationBar appearance

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:245.0/255.0 green:245.0/255.0 blue:245.0/255.0 alpha:1.0], NSForegroundColorAttributeName,shadow, NSShadowAttributeName, [UIFont fontWithName:@"HelveticaNeue-CondensedBlack" size:21.0], NSFontAttributeName, nil]];

For more navbar customization refer http://www.appcoda.com/customize-navigation-status-bar-ios-7/

karthikPrabhu Alagu
  • 3,371
  • 1
  • 21
  • 25