如何更改UITabBar选择颜色 [英] How to change UITabBar Selection color

查看:149
本文介绍了如何更改UITabBar选择颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将UITabBar的选择颜色从默认蓝色更改为红色。我们如何做到这一点。

I need to change the selection color of UITabBar from default blue to red. How do we do this.

推荐答案

你可以通过为你的UITabBar设置一个tintColor属性

You can do this by setting a "tintColor" attribute (Key Path) for you UITabBar.


  1. 在文档大纲中选择UITabBar。

  2. 在实用程序区域中选择身份检查器。

  3. 单击+ inUser Defined Runtime Attributes。

  4. 添加类型为Color的颜色的tintColor键路径和所需的颜色。

  1. Select the UITabBar in the document outline. (NOT the Controller with the yellow icon.)
  2. Select Identity Inspector in the Utilities area.
  3. Click the + in "User Defined Runtime Attributes."
  4. Add a "tintColor" Key Path of type "Color" and the color you want.

这应该做。您可以根据下面的屏幕截图检查它。

This should do it. You can check it against the screenshot below.

更多:
UITabBar的Identity Inspector中有一个Tint属性,我相信它会做同样的事情,但显然它什么都不做。它的默认值是精确的默认填充颜色,当选择UITabBarItem时,所以我的猜测是它会在稳定版本Xcode 7中修复。手指交叉。

More on this: There's a "Tint" attribute in Identity Inspector of UITabBar which I believed would do the exact same thing but apparently, it does nothing. It's default value is the exact default fill color when a UITabBarItem is selected, so my guess is it would be fixed in the stable release Xcode 7. Fingers crossed.

这篇关于如何更改UITabBar选择颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆