在iOS7下设置自定义UITabBar字体颜色
似乎在iOS7下设置自定义UITabBar字体颜色,uitabbar,ios7,uicolor,Uitabbar,Ios7,Uicolor,似乎[[UITabBar外观]设置了SelectedImageTintColor:[UIColor redColor]]在iOS7下不再正常工作。我可以设置背景图像,但选定的文本不再是红色。我是从我的申请代表那里打电话来的。是否有人试图在iOS7下设置uitabar字体颜色和样式?在iOS7中,它是tintColor,请尝试以下操作: [[UITabBar appearance] setTintColor:[UIColor redColor]]; 编辑: 要为非活动按钮着色,请将以下代码放入V
[[UITabBar外观]设置了SelectedImageTintColor:[UIColor redColor]]代码>在iOS7下不再正常工作。我可以设置背景图像,但选定的文本不再是红色。我是从我的申请代表那里打电话来的。是否有人试图在iOS7下设置uitabar
字体颜色和样式?在iOS7中,它是tintColor
,请尝试以下操作:
[[UITabBar appearance] setTintColor:[UIColor redColor]];
编辑:
要为非活动按钮着色,请将以下代码放入VC的viewDidLoad
:
[self.tabBarItem setFinishedSelectedImage:[UIImage imageNamed:@"item_seleted.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"item_unselected.png"]];
要对非活动项目着色,我使用了此选项
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"];
这对我很管用
[[UITabBar appearance] setBarTintColor:[UIColor blackColor]];
[[UITabBar appearance] setTintColor:[UIColor whiteColor]];