How can I change the text and icon colors for UITabBar and UITabBarItems in iOS 7? The default gray text seems dim and hard to read for unselected tabbar items.
This Should Work Perfectly for iOS 8 also
For unselected tabbar item:
[[UIView appearanceWhenContainedIn:[UITabBar class], nil] setTintColor: [UIColor whiteColor]];
For selected tabbar item:
[[UITabBar appearance] setTintColor:[UIColor orangeColor]];
@Usharao answer above worked for me;
My problem was on startup all my TabBarItems seemed to be in a selected state, all having the same "Blue" tinted colour. By selecting all the tabs one by one the coloured state would become corrected.
I used this code below in my AppDelegate class: (compatible for >= IOS9)
[[UIView appearanceWhenContainedInInstancesOfClasses:@[[UITabBar class]]]
setTintColor:[UIColor lightGrayColor]];
Ed's answer is perfect, but let me add one thing. TabBar is in default translucent thus affected by the color of view under the TabBar (i.e. each member viewController's view's color affects TabBar appearance.).
So I set below code not to be affected.
self.tabBarController.tabBar.translucent = false;
Together with Ed's answer here is a complete code I use now.
self.tabBarController.tabBar.barTintColor = [UIColor blackColor];
self.tabBarController.tabBar.translucent = false;
self.tabBarController.tabBar.tintColor = [UIColor blueColor];
Now from iOS10
one can use
@property (nonatomic, readwrite, copy, nullable) UIColor *unselectedItemTintColor
to change default color for TabBarItem
image and text at unselected state.
Thus, the pair of properties tintColor
and unselectedItemTintColor
gives us full control on items colors.
You try it
for (UITabBarItem *item in self.tabBarController.tabBar.items) {
item.image = [[UIImage imageNamed:@"youimage.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
[[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
[UIColor whiteColor], UITextAttributeTextColor,
nil] forState:UIControlStateNormal];
item.selectedImage = [UIImage imageNamed:@"youimage.png"];
}