【问题标题】:How to change the default grey icon colors for tabBarItems in iOS 7?如何更改 iOS 7 中 tabBarItems 的默认灰色图标颜色?
【发布时间】:2014-01-01 08:34:53
【问题描述】:
【问题讨论】:
标签:
ios7
uitabbarcontroller
xcode5
uitabbar
appearance
【解决方案1】:
realtyTypeTabBar.selectedImageTintColor = [UIColor colorWithRed:206.0/256.0 green:221.0/256.0 blue:166.0/256.0 alpha:1];
[realtyTypeTabBar setSelectionIndicatorImage:[UIImage emptyImageWithSize:itemSize andBackgroundColor:[UIColor colorWithRed:84.0/256.0 green:115.0/256.0 blue:0 alpha:1]]];
for(UITabBarItem* item in realtyTypeTabBar.items)
{
item.image = [item.image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
[item setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor whiteColor]} forState:UIControlStateNormal];
[item setTitleTextAttributes:@{NSForegroundColorAttributeName : realtyTypeTabBar.tintColor} forState:UIControlStateSelected];
}
【解决方案2】:
您可以使用故事板轻松更改,您只需在故事板的 tabBarController 中选择 TabBar,并在用户定义的运行时属性中的显示身份检查器中添加“unselectedItemTintColor”并将类型更改为颜色然后你可以像照片一样选择你想要的颜色