I need to change the selection color of UITabBar from default blue to red. How do we do this.
13 Answers
Update September 2017: It's been two years since I've written this answer and since it's receiving upvotes regularly, I should say this is probably the worst possible answer to this question, it's error prone, likely to break because of iOS updates, hard to debug, etc., so please don't do the things I've written and apply better solutions such as subclassing UITabBar or UITabBarController. Thanks.
You can do this by setting a "tintColor" attribute (Key Path) for you UITabBar.
- Select the UITabBar in the document outline. (NOT the Controller with the yellow icon.)
- Select Identity Inspector in the Utilities area.
- Click the + in "User Defined Runtime Attributes."
- Add a "tintColor" Key Path of type "Color" and the color you want.
This should do it. You can check it against the screenshot below.
More on this: There's a "Tint" attribute in Identity Inspector of UITabBar which I believed would do the exact same thing but apparently, it does nothing. It's default value is the exact default fill color when a UITabBarItem is selected, so my guess is it would be fixed in the stable release Xcode 7. Fingers crossed.

- 941
- 12
- 23
-
you can do this on xcode 6 too, good answer, this should be the solution – Alejandro Moya Sep 12 '15 at 18:00
-
seems like this still isn't fixed in the official release of xcode 7 - this answer saved me some headache, thank you! – Blake Lockley Dec 01 '15 at 11:37
In IOS5, UITabBar has a selectedImageTintColor property which does what you need.

- 13,585
- 9
- 54
- 68

- 199
- 1
- 2
-
1@KPM, I see it's deprecated, but what should we use instead? This is still working on iOS 8, for what it's worth. – Jared Egan Sep 28 '14 at 22:10
In iOS 7 it's simply the tintColor. One way to accomplish this could be to subclass UITabBarViewController, set the custom class in the storyboard, and in your viewDidLoad
method of the subclassed tabBarVC add this:
[[self tabBar] setTintColor:[UIColor redColor]];

- 38,547
- 26
- 130
- 141
-
1I constantly as my self: "Why do I have to create a subclass for such a minor thing like changing colors?". Good question, why the f* don't simply automatically inherit the tintColor from the parent view? And why doesn't the interface builder setting don't do nothing? – Julian F. Weinert Jul 10 '15 at 11:50
-
-
1[self.tabBarController.tabBar setTintColor:[UIColor redColor]]; would also do the trick. – Gellie Ann Jan 28 '16 at 22:58
-
and if you want to set the color for the unselected text it's `unselectedItemTintColor` – TheEye Mar 09 '17 at 14:20
To achieve above result perform following steps.
Step 1: Add your desired images in Assets.xcassets
, and make sure they Render As
: Default
Step 2: Select your UITabBar
object and set Image Tint
color, this color will be selected tab color
Step 3: Select UITabBar
object and add Key Path: unselectedItemTintColor
, Type: Color
, Value: Choose color for unselected item
in User Defined Runtime Attributes.
All done.

- 16,304
- 7
- 99
- 130
It is extremely easy
Create a custom class of UITabBarController and in -(void)viewDidLoad
method add this line:
[[self tabBar] setSelectedImageTintColor:[UIColor greenColor]];

- 1,321
- 12
- 25
-
but this will change color of Text, not the entire selection area. Any way to achieve that? – Vaibhav Saran Feb 09 '15 at 05:53
Because UITextAttributeTextColor is deprecated in iOS 7, you should use:
[UITabBarItem.appearance setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor greenColor]} forState:UIControlStateNormal];
[UITabBarItem.appearance setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor purpleColor]} forState:UIControlStateSelected];

- 8,165
- 6
- 62
- 81
Starting from iOS 8 it's as simple as:
UITabBar.appearance().tintColor = UIColor.redColor()

- 30,606
- 13
- 135
- 162
Simply change the following property in Interface Builder for the TabBar
Obviously in my case its White.

- 900
- 1
- 12
- 16
Swift 5 Programatically
It is pretty easy in Swift 5.
In your TabBarController
write this:
tintColor = UIColor.red
That's it

- 113
- 1
- 5
The SDK does not make this easy, but it is technically possible. Apple apparently believes this to be part of their vision of a consistent look and feel.
UITabBar is a subclass of UIView. You can always subclass and implement your own -drawRect:
This is not a trivial task, however, you have to essentially re-implement the class from scratch or you risk some weird side-effects.

- 10,045
- 1
- 36
- 33
I've been searching for a way to set the selected text color of a UITabBarItem and have found a dead simple method, using the UIAppearance protocol.
[UITabBarItem.appearance setTitleTextAttributes:@{
UITextAttributeTextColor : [UIColor greenColor] } forState:UIControlStateNormal];
[UITabBarItem.appearance setTitleTextAttributes:@{
UITextAttributeTextColor : [UIColor purpleColor] } forState:UIControlStateSelected];
Please excuse the awful colors!

- 80,996
- 26
- 120
- 129
iOS 5.0 fixes this issue but the solution is under NDA. Look up UITabBar in your documentation for an EASY way to do what you want to do.

- 14,425
- 24
- 101
- 194
I found the easiest solution -
Select Tab Bar in Tab Bar Controller
Set Image Tint color
Set Tint Color
For reference see the attached image.

- 568
- 4
- 15