ios13-unSelectedItem的UITabBar tintColor不起作用

问题描述 投票:2回答:3

在Xcode 10中,unselectedItemTintColor属性正常工作,但是在ios 13 UITabbar的Xcode 11之后,unselectedItemTintColor属性不工作。

override func viewDidLoad() {
    super.viewDidLoad()

    myTabbar.unselectedItemTintColor = .red
}
ios swift uitabbar ios13 uitabbaritem
3个回答
1
投票

带有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
}

0
投票

您可以使用以下代码设置颜色...

self.tabBar.unselectedItemTintColor = your colour

我希望它对您有用...:)


0
投票

您可以使用以下代码设置颜色...

UITabBar.appearance()。unselectedItemTintColor = yourColour

© www.soinside.com 2019 - 2024. All rights reserved.