[[UITabBar appearance] setTintColor:[UIColor redColor]]; // for unselected items that are red
[[UITabBar appearance] setSelectedImageTintColor:[UIColor greenColor]]; // for selected items that are green
为什么这段代码在iOS 7中不起作用?
setSelectedImageTintColor setTintColor只会改变图标的颜色,而不像以前的iOS版本那样改变图标的颜色,这很奇怪吗?真的
我想在ios7中更改选项卡栏中非活动图标的颜色。
我知道如何设置选定TabBar项的颜色,但我不知道如何设置非活动TabBar项的颜色。
有人知道怎么做吗?提前感谢!!
这是我在appDelegate.m中的代码
//tint color for tabbar
[UITabBar appearance].barTintColor = [UIColor colorWithRed:0.077 green:0.411 blue:0.672 alpha:1.000];
//tint color for the text of inactive tabbar item.
[[UITabBarItem
当我设置UITabBar的背景色时,iOS会自动淡化这个颜色,因为默认的UITabBar是半透明的。
但是我想使用UITabBar,它是,而不是半透明的。在iOS 12及以下版本中,我通过设置所需颜色的背景图像来解决这个问题:
// Create an image from a given color using a custom extension
[[UITabBar appearance] setBackgroundImage:[UIImage colorImageWithColor:[UIColor redColor]]];
,这个工作很好,。然而,我想在iOS 13中使用新的黑暗模式