Set a custom font color for UITabBar in iOS7

It seems that [[UITabBar appearance] setSelectedImageTintColor:[UIColor redColor]]; no longer works under iOS7. I can set the background image, but the selected text no longer gets red. I call this from my application delegate. Has anyone tried to set the color and style of the UITabBar font in iOS7?

+4
source share
3 answers

In iOS7 tintColor , try the following:

 [[UITabBar appearance] setTintColor:[UIColor redColor]]; 

Edit

To tint inactive buttons, enter the code below into your VC viewDidLoad :

 [self.tabBarItem setFinishedSelectedImage:[UIImage imageNamed:@"item_seleted.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"item_unselected.png"]]; 
+3
source

It worked for me ..

 [[UITabBar appearance] setBarTintColor:[UIColor blackColor]]; [[UITabBar appearance] setTintColor:[UIColor whiteColor]]; 
+4
source

To display inactive elements, I used this

 UITabBarItem *item = [self.tabBar.items objectAtIndex:1]; // here you need to use the icon with the color you want, as it will be rendered as it is item.image = [[UIImage imageNamed:@"unselected.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; // this icon is used for selected tab and it will get tinted as defined in self.tabBar.tintColor item.selectedImage = [UIImage imageNamed:@"selected.png"]; 
+2
source

Source: https://habr.com/ru/post/1502412/


All Articles