我尝试更改 UITabBarItems
的背景颜色,以摆脱图标周围这些难看的绿色边框
当我在 AppDelegate
中注释掉这一行时,问题就消失了:
UIView.appearance().backgroundColor = UIColor(red: 0.12, green: 0.67, blue: 0.478, alpha: 1)
我已经尝试了几种方法,但当我想要绿色的 UIView 背景和带有白色图标和字体的浅黑色导航栏时,似乎没有机会做到这一点。
这是我的 UITabBar
的设置。将半透明从 true 更改为 false 并没有解决问题..
最佳答案
通过代码我尝试改变它它的工作原理。 只需尝试以下代码行(通过指定您自己的颜色):
self.tabBarController?.tabBar.tintColor = UIColor.white
self.tabBarController?.tabBar.unselectedItemTintColor = UIColor.white
self.tabBarController?.tabBar.selectionIndicatorImage = UIImage.imageWithColor(color: UIColor.blue,size: tabBarItemSize).resizableImage(withCapInsets: .zero)
希望对你有帮助
关于ios - UITabBarItem 的背景颜色?(Swift/xCode),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49098754/