【发布时间】:2015-06-02 11:07:48
【问题描述】:
我禁用了 tabBar 项目,然后 bar 按钮变成灰色。
我想改变它的颜色,但不能这样做。它默认为灰色。
当我 setEnabled 为 true 时,它显示原始颜色为白色。
[[[[self.tabBarController tabBar]items]objectAtIndex:0]setEnabled:FALSE];
【问题讨论】:
标签: ios
我禁用了 tabBar 项目,然后 bar 按钮变成灰色。
我想改变它的颜色,但不能这样做。它默认为灰色。
当我 setEnabled 为 true 时,它显示原始颜色为白色。
[[[[self.tabBarController tabBar]items]objectAtIndex:0]setEnabled:FALSE];
【问题讨论】:
标签: ios
我在appDelegate 中使用过它,对我来说效果很好。
[[UIView appearanceWhenContainedIn:[UITabBar class], nil] setTintColor:[UIColor whiteColor]];
[[UITabBar appearance] setTintColor:[UIColor whiteColor]];
但是当我在viewController 类中设置启用 False 时,它会变成灰色。
【讨论】:
// this will generate a red tab bar
tabBarController.tabBar.barTintColor = [UIColor redColor];
// this will give selected icons and text your apps tint color
tabBarController.tabBar.tintColor = [UIColor redColor];
更新:
self.tabBarController.tabBar.barTintColor = [UIColor blackColor];
self.tabBarController.tabBar.translucent = false;
self.tabBarController.tabBar.tintColor = [UIColor blueColor];
【讨论】: