1
我想根據用戶的操作在文件顏色加載後更改UITabBarControllers
文本顏色。是否可以在加載後更改UITabBarController文本顏色?
我可以調用它,它會在啓動時正確更改字體和顏色。
let appearance = UITabBarItem.appearance()
let attributes: [String: AnyObject] = [NSFontAttributeName:UIFont(name: "American Typewriter", size: 12)!, NSForegroundColorAttributeName: UIColor.green]
appearance.setTitleTextAttributes(attributes, for: .normal)
當我嘗試在應用程序完全啓動後的任何時候調用此函數時,沒有任何反應。
這是可能的嗎,還是啓動時可以做的一次性事情?
你可以用'UITabBarItem.appearance()setTitleTextAttributes檢查。([NSForegroundColorAttributeName:UIColor.redColor()],forState:.Selected)'或正常狀態做'.Normal' –
或者用'tabBarController檢查.tabBar' tintColor –
你應該試試這個 - http://stackoverflow.com/questions/31117069/changing-tab-bar-item-image-and-text-color-ios –