- 最近在學習Swift, 起了個項目, 發現了tabBarItem未選中狀態文字的顏色不起作用了, 默認的是系統的灰色
UITabBarItem.appearance().setTitleTextAttributes([NSAttributedString.Key.foregroundColor: UIColor.green], for: .selected)
UITabBarItem.appearance().setTitleTextAttributes([NSAttributedString.Key.foregroundColor: UIColor.red], for: .normal)

問了下, 有人說是iOS13的問題, 具體是不是iOS 13的問題, 自己沒有去認證
解決方案
iOS 13下 UITabBarItem.appearance().setTitleTextAttributes([NSAttributedString.Key.foregroundColor: UIColor.red], for: .normal)設置normal狀態的屬性已經不起作用了, 蘋果這通瞎幾把搞, 不難受嗎
tabBar.tintColor = UIColor.blue
// 通過UITabBar.appearance() 點不出unselectedItemTintColor屬性, 可以直接硬敲
// UITabBar.appearance().unselectedItemTintColor = UIColor.red
tabBar.unselectedItemTintColor = UIColor.red
或者
UITabBarItem.appearance().setTitleTextAttributes([NSAttributedString.Key.foregroundColor: UIColor.green], for: .selected)
tabBar.unselectedItemTintColor = UIColor.red

