【问题标题】:How to change the default grey icon colors for tabBarItems in iOS 7?如何更改 iOS 7 中 tabBarItems 的默认灰色图标颜色?
【发布时间】:2014-01-01 08:34:53
【问题描述】:

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

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

【问题讨论】:

    标签: 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”并将类型更改为颜色然后你可以像照片一样选择你想要的颜色

    【讨论】:

      猜你喜欢
      • 2013-09-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-01-15
      • 1970-01-01
      相关资源
      最近更新 更多