如何为未选中状态的 tabBar 项目设置 tintColor
how can I set the tintColor for the tabBar item for the unselected state
我们可以使用属性tintColor
为选中状态设置UITabBar
项颜色,但是如何设置未选中状态下标签栏项的tintColor?
您可以像这样为选中和未选中的标签栏按钮设置色调颜色:
[[UIView appearanceWhenContainedIn:[UITabBar class], nil] setTintColor:[UIColor redColor]];
[[UITabBar appearance] setSelectedImageTintColor:[UIColor greenColor]];
[自行计算文件夹大小];
第一行设置 unselected
颜色——在这个例子中是红色——当它包含在标签栏中时,通过设置 UIView 的 tintColor
。请注意,这只会设置 unselected
图片的色调 - 它不会更改下方文本的颜色。
第二行将选项卡栏的选定 image
色调 color
设置为绿色。
也许它会对你有所帮助。
我们可以使用属性tintColor
为选中状态设置UITabBar
项颜色,但是如何设置未选中状态下标签栏项的tintColor?
您可以像这样为选中和未选中的标签栏按钮设置色调颜色:
[[UIView appearanceWhenContainedIn:[UITabBar class], nil] setTintColor:[UIColor redColor]];
[[UITabBar appearance] setSelectedImageTintColor:[UIColor greenColor]];
[自行计算文件夹大小];
第一行设置 unselected
颜色——在这个例子中是红色——当它包含在标签栏中时,通过设置 UIView 的 tintColor
。请注意,这只会设置 unselected
图片的色调 - 它不会更改下方文本的颜色。
第二行将选项卡栏的选定 image
色调 color
设置为绿色。
也许它会对你有所帮助。