明日も楽をするために

めんどくさがりなITエンジニアが書くメモ帳

iOSでTabbarのテキストの色を変更する

選択後の色に関しては別の方法もあるが、選択前の色も変える方法

let font:UIFont! = UIFont(name:"HiraKakuProN-W3",size:10)
let selectedAttributes = [NSFontAttributeName : font, NSForegroundColorAttributeName : UIColor.whiteColor()]
UITabBarItem.appearance().setTitleTextAttributes(selectedAttributes, forState: UIControlState.Normal)
UITabBarItem.appearance().setTitleTextAttributes(selectedAttributes, forState: UIControlState.Selected)