如何更改iOS 7中tabBarItems的默认灰色图标颜色?

时间:2013-12-13 14:23:32

标签: ios7 uitabbarcontroller xcode5 uitabbar appearance

我搜索并尝试了所有可能的解决方案无济于事。我想要的是将未选择的默认灰色颜色更改为更暗的颜色。我正在使用Xcode 5和iOS 7.有人会帮忙吗?

(我尝试了所有这些以及更多:How can I change the text and icon colors for tabBarItems in iOS 7?

2 个答案:

答案 0 :(得分:0)

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];
}

答案 1 :(得分:0)

你可以使用故事板来改变那么简单你只需要在故事板中的tabBarController中选择TabBar,并在用户定义的运行时属性中的show identity inspector中添加“unselectedItemTintColor”并将类型更改为颜色然后你可以像照片you can see what I said

一样选择你想要的颜色
相关问题