UIBarButtonItem的setTitleTextAttributes方法不起作用

来源:互联网 发布:网络侵犯著作权案例 编辑:程序博客网 时间:2024/05/22 00:09

navtionItem中通过setTitleTextAttributes:  forState:方法设置UIbarButtonItem的字体,颜色。。会不起作用

必须设置了Normal状态的字体颜色,disabled状态的设置才会起作用也是醉了

leftNavButton?.setTitleTextAttributes([NSForegroundColorAttributeName: UIColor.whiteColor()] as [String: AnyObject], forState: UIControlState.Disabled)leftNavButton?.setTitleTextAttributes([NSForegroundColorAttributeName: UIColor.whiteColor()] as [String: AnyObject], forState: UIControlState.Highlighted)leftNavButton?.setTitleTextAttributes([NSForegroundColorAttributeName: UIColor.whiteColor()] as [String: AnyObject], forState: UIControlState.Normal)leftNavButton?.enabled = false


0 0