It seems that [[UITabBar appearance] setSelectedImageTintColor:[UIColor redColor]];
is no longer working propertly under iOS7. I can set the background image, but the selected text is no longer getting the red color. I'm calling this from my application delegate. Has anyone tried to set the UITabBar
font color and style under iOS7?
问问题
7349 次
3 回答
4
It worked for me..
[[UITabBar appearance] setBarTintColor:[UIColor blackColor]];
[[UITabBar appearance] setTintColor:[UIColor whiteColor]];
于 2014-01-21T15:06:22.597 回答
3
It is tintColor
in iOS7, try the below:
[[UITabBar appearance] setTintColor:[UIColor redColor]];
Edit:
To tint the non active buttons, put the below code in your VC's viewDidLoad
:
[self.tabBarItem setFinishedSelectedImage:[UIImage imageNamed:@"item_seleted.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"item_unselected.png"]];
于 2013-09-16T13:25:09.443 回答
2
To tint not active items 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"];
于 2013-10-29T17:12:33.180 回答