I would like a different background color when the user selects a tab bar item than when it is unselected.
Please refer below URL's.
Changing Tint / Background color of UITabBar
How To Change Tab bar color in Xcode
hope this will help you..
try this to change tabbar item color but it only work in ios5.
if ([UITabBar instancesRespondToSelector:@selector(setSelectedImageTintColor:)])
{
[tabBarController.tabBar setSelectedImageTintColor:[UIColor redColor]];
}
Put this in your AppDelegate.m file:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
[UITabBar appearance].selectionIndicatorImage = [UIImage imageNamed:@"activeTabBackgroundImage"];
return YES;
}
Answer in swift 4:
setSelectedImageTintColor is deprecated on iOS 8.
Instead use this :
self.tabBar.tintColor = UIColor.white
In Swift
UITabBar.appearance().selectionIndicatorImage = UIImage(named: "tabSelected")
with an image tabSelected@2x.png
of size 98x98 pixels
You can use tintcolor.
[[UITabBar appearance] setSelectedImageTintColor:[UIColor redColor]];
In AppDelegate.m, put the following code after // Override point for customization after application launch.