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)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…