I'm assuming that you do not want to change the color using tintColor? Another option is to use two images that look exactly the same, but differ in color. One image is the selected tab, the other is unselected.
In your AppDelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
function, try this.
UITabBarController *tabBarController = (UITabBarController *)self.window.rootViewController;
UITabBar *tabBar = tabBarController.tabBar;
// repeat for every tab, but increment the index each time
UITabBarItem *firstTab = [tabBar.items objectAtIndex:0];
// also repeat for every tab
firstTab.image = [[UIImage imageNamed:@"someImage.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal ];
firstTab.selectedImage = [[UIImage imageNamed:@"someImageSelected.png"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
Edit: For those who don't have the tab bar controller as their root view controller, you can grab the controller like this and the rest of the code is the same.
UITabBarController *tabBarController = self.tabBarController;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…