25

I have been looking around online for an answer to this question for several days now with no success. Essentially what I want to do is change the highlight colour of the icons in my UITabBar. By default they are highlighted in blue when selected, however I have seen several apps that have managed to change this (eg. McDonalds app, shown below).

enter image description here

What I would like to be able to do is set the highlight colour to red, if this is even possible please can someone help me?

NOTE: If it makes things any easier I'm targeting this app at users of iOS5+.

3 Answers3

71

You can do this using the appearance proxy, new in iOS 5. In your app delegate's didFinishLaunching method:

[[UITabBar appearance] setSelectedImageTintColor:[UIColor redColor]];

In iOS 7 use:

[[UITabBar appearance] setTintColor:[UIColor redColor]];

See the UITabBar class reference for more details.

juhan_h
  • 3,965
  • 4
  • 29
  • 35
jrturton
  • 118,105
  • 32
  • 252
  • 268
  • Awesome Answer! I made a little method to convert hex values to uicolor and passed the colour to his. It worked like a charm! Thank you. – Septronic Nov 03 '15 at 23:12
8

In swift put this:

 UITabBar.appearance().tintColor = UIColor.redColor()

inside of the app delegate's didFinishLaunching method... Just keeping up with the times.

Gregory Hansell
  • 126
  • 1
  • 2
2

Try this :

[[[UITabBarItem alloc] init] setFinishedSelectedImage:(UIImage *)myImageRed.png withFinishedUnselectedImage:myImage.png];
moxy
  • 1,634
  • 1
  • 11
  • 19