您可以在本地解決此問題(例如,如果你有一個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
請參閱下面的答案。希望這已經爲你解決了。 –