似乎[[UITabBar appearance] setSelectedImageTintColor:[UIColor redColor]];
在iOS7下不再有效。我可以设置背景图像,但所选文本不再是红色。我从我的申请代表那里打电话给我。有没有人试图在iOS7下设置UITabBar
字体颜色和样式?
答案 0 :(得分:4)
它对我有用..
[[UITabBar appearance] setBarTintColor:[UIColor blackColor]];
[[UITabBar appearance] setTintColor:[UIColor whiteColor]];
答案 1 :(得分:3)
在iOS7中为tintColor
,请尝试以下操作:
[[UITabBar appearance] setTintColor:[UIColor redColor]];
修改强>:
要为非活动按钮着色,请将以下代码放入VC的viewDidLoad
:
[self.tabBarItem setFinishedSelectedImage:[UIImage imageNamed:@"item_seleted.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"item_unselected.png"]];
答案 2 :(得分:2)
要使用此
来设置不活动的项目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"];