Is there a way to change the tint of a tab bar on iOS 7 from the default white with blue icons to another color tint with different color buttons?
-
You may have to subclass it. I have never tried so I am not 100% sure, but this seems a possible solution – erdekhayser Sep 13 '13 at 21:01
9 Answers
Try the below:
[[UITabBar appearance] setTintColor:[UIColor redColor]];
[[UITabBar appearance] setBarTintColor:[UIColor yellowColor]];
To tint the non active buttons, put the below code in your VC's viewDidLoad
:
UITabBarItem *tabBarItem = [yourTabBarController.tabBar.items objectAtIndex:0];
UIImage *unselectedImage = [UIImage imageNamed:@"icon-unselected"];
UIImage *selectedImage = [UIImage imageNamed:@"icon-selected"];
[tabBarItem setImage: [unselectedImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
[tabBarItem setSelectedImage: selectedImage];
You need to do this for all the tabBarItems, and yes I know it is ugly and hope there will be cleaner way to do this.
Swift:
UITabBar.appearance().tintColor = UIColor.red
tabBarItem.image = UIImage(named: "unselected")?.withRenderingMode(.alwaysOriginal)
tabBarItem.selectedImage = UIImage(named: "selected")?.withRenderingMode(.alwaysOriginal)

- 18,422
- 7
- 59
- 68
-
1Perfect. Thanks. One more quick question, is there a way to tint the non active buttons in the tab bar, (they are gray when not selected)? – Jake Chasan Sep 14 '13 at 15:40
-
2
-
@null Code for non active buttons has forState:UIControlStateNormal which changes color of all tab bar items (selected and non-selected) in my application. There's other state UIControlStateSelected but didn't see non-selected. – Sharjeel Nov 05 '13 at 23:08
-
1[[UITabBarItem appearance] setTitleTextAttributes.. did not change the color of the unselected items, they remain gray. – Tom Kincaid Feb 14 '14 at 14:56
-
Use UIControlStateNormal for all tabbar items, use UIControlStateSelected for selected items, example: [[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor], NSForegroundColorAttributeName, nil] forState:UIControlStateSelected]; – user8675 May 05 '14 at 16:57
There is an much easier way to do this.
Just open the file inspector and select a "global tint".
You can also set an app’s tint color in Interface Builder. The Global Tint menu in the Interface Builder Document section of the File inspector lets you open the Colors window or choose a specific color.
Also see:

- 239
- 1
- 2
-
8
-
5
-
3Doesn't work, Xcode 5.1. "window.tintColor = [UIColor purpleColor]" does. – Sofi Software LLC Mar 20 '14 at 17:11
-
1The Global Tint setting of the Interface Builder Document doesn't actually allow you to set the tint for an app. It allows you to set the tint for a Storyboard - if you have multiple, you can mix and match or set it in code as above. – jbbenni Apr 13 '14 at 22:32
-
1How odd. I had just tried setting the tint color in the Storyboard, in iOS 7, Xcode 5.1.1 and it does nothing for a Storyboard created UITabBar. – Alex Zavatone May 15 '14 at 19:27
-
This only addresses half of the problem. How about the icons themselves. How do you set their colors in storyboard? – Katedral Pillon Aug 14 '14 at 19:54
iOS 7.1.1
If someone is going to need to use globally setting tint color:
[[UIView appearance] setTintColor:[UIColor whiteColor]];
In didFinishLaunchingWithOptions
of AppDelegate
.
Also below code will change only tab bar tint color in any viewDidLoad
method:
[self.tabBarController.tabBar setTintColor:[UIColor redColor]];

- 14,325
- 6
- 82
- 89

- 3,792
- 6
- 37
- 63
-
If you use this option, can you still override the color on a screen-by-screen basis? – Jake Chasan Apr 23 '14 at 17:01
-
With the code on second line you can override the color for each screen seperately – Ömer Faruk Almalı Apr 23 '14 at 18:01
-
1This is the only solution I have found that works from a VC's VDL in iOS 7 for the current tab item. [self.tabBarController.tabBar setTintColor:[UIColor orangeColor]]; – Alex Zavatone May 15 '14 at 19:54
In app delegate didFinishLaunchingWithOptions:
window.tintColor = [UIColor purpleColor];
sets the tint color globally for the app.

- 3,879
- 1
- 36
- 34
-
Does nothing on iOS 7.1 in Xcode 5.1.1. Even when using _window in the AppDelegate. – Alex Zavatone May 15 '14 at 19:58
Write this in your View Controller class of your Tab Bar:
// Generate a black tab bar
self.tabBarController.tabBar.barTintColor = [UIColor blackColor];
// Set the selected icons and text tint color
self.tabBarController.tabBar.tintColor = [UIColor orangeColor];

- 6,290
- 9
- 44
- 90

- 411
- 4
- 13
What finally worked for me was:
[self.tabBar setTintColor:[UIColor redColor]];
[self.tabBar setBarTintColor:[UIColor yellowColor]];

- 30,738
- 21
- 105
- 131

- 9,493
- 4
- 53
- 47
In "Attributes Inspector" of your Tab Bar Controller within Interface Builder make sure your Bottom Bar is set to Opaque Tab Bar:
Now goto your AppDelegate.m file. Find:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
And then add this code between the curly braces to change the colors of both the tab bar buttons and the tab bar background:
///----------------SET TAB BAR COLOR------------------------//
//--------------FOR TAB BAR BUTTON COLOR---------------//
[[UITabBar appearance] setTintColor:[UIColor greenColor]];
//-------------FOR TAB BAR BACKGROUND COLOR------------//
[[UITabBar appearance] setBarTintColor:[UIColor whiteColor]];
After trying out all the suggested solutions, I couldn't find any very helpful.
I finally tried the following:
[self.tabBar setTintColor:[UIColor orangeColor]];
which worked out perfectly.
I only provided one image for every TabBarItem. Didn't even need a selectedImage.
I even used it inside the Child-ViewControllers to set different TintColors:
UIColor *theColorYouWish = ...;
if ([[self.parentViewController class] isSubclassOfClass:[UITabBarController class]]){
UITabBarController *tbc = (UITabBarController *) self.parentViewController;
[tbc.tabBar setTintColor:theColorYouWish];
}

- 324
- 4
- 13
You can set your tint color and font as setTitleTextattribute:
UIFont *font= (kUIScreenHeight>KipadHeight)?[UIFont boldSystemFontOfSize:32.0f]:[UIFont boldSystemFontOfSize:16.0f];
NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:font, NSFontAttributeName,
tintColorLight, NSForegroundColorAttributeName, nil];
[[UINavigationBar appearance] setTitleTextAttributes:attributes];

- 30,738
- 21
- 105
- 131