不废话,直接上代码
func setTabBarTitleColor() {
if #available(iOS 13.0, *) {
UITabBar.appearance().tintColor = UIColor.red
UITabBar.appearance().unselectedItemTintColor = UIColor.black
} else {
UITabBarItem.appearance().setTitleTextAttributes([NSAttributedString.Key.foregroundColor : UIColor.black], for: .normal)
UITabBarItem.appearance().setTitleTextAttributes([NSAttributedString.Key.foregroundColor : UIColor.red], for: .selected)
}
}
网友评论