在Xcode 10中,unselectedItemTintColor属性正常工作,但是在ios 13 UITabbar的Xcode 11之后,unselectedItemTintColor属性不工作。
override func viewDidLoad() {
super.viewDidLoad()
myTabbar.unselectedItemTintColor = .red
}
带有Xcode 11的iOS 13
if #available(iOS 13, *) {
let appearance = UITabBarAppearance()
appearance.stackedLayoutAppearance.normal.titleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.black]
appearance.stackedLayoutAppearance.selected.titleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.red]
myTabbar.standardAppearance = appearance
}
您可以使用以下代码设置颜色...
self.tabBar.unselectedItemTintColor = your colour
我希望它对您有用...:)
您可以使用以下代码设置颜色...
UITabBar.appearance()。unselectedItemTintColor = yourColour