您可以在本地解决此问题(例如,如果你有一个CustomTabBarController)和全局。我在这里提供两种解决方案,只为你:
1.本地:
class YourCustomTabBarVC: UITabBarController {
//MARK:- Initializers
required init?(coder aDecoder:NSCoder) {
super.init(coder: aDecoder)
__customInit()
}
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
__customInit()
}
fileprivate func __customInit() {
addObservers()
//Customize TabBar appearance:
tabBar.backgroundColor = UIColor.white
}
}
2.全球:在您的AppDelegate.swift:
func application(_ application: UIApplication,
didFinishLaunchingWithOptions
launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
/* Your other code*/
UITabBar.appearance().backgroundColor = UIColor.white // {UR_DESIRED_COLOR}
}
我会建议你使用全局方法。添加那一行,瞧!你将会争先恐后地在这里写下个人感谢信息!
这看起来像你有另一个视图或掩码的顶部。不仅背景不同,标签图像颜色也显得不同。或者检查一些alpha-s。如果你已经设置了一些alpha,那么之前的iOS SDK可能还没有明白。 – pedrouan
请参阅下面的答案。希望这已经为你解决了。 –