ios - Change Icon Color Tab Bar Controller-SWIFT -
i working in xcode 6 swift , have been able change color of text on tab bar controller, cannot color change on icons themselves. code below in appdelegate:
func application(application: uiapplication, didfinishlaunchingwithoptions launchoptions: [nsobject: anyobject]?) -> bool { uitabbaritem.appearance().settitletextattributes([nsforegroundcolorattributename: uicolor(red: 239/255, green: 64/255, blue: 54/255, alpha: 1.0)], forstate: .selected) uitabbaritem.appearance().settitletextattributes([nsforegroundcolorattributename: uicolor.whitecolor()], forstate: .normal)
i have separate class navigation controller change text , color.
you need set image
on tab bar item uiimage
renderingmode = uiimagerenderingmode.alwaystemplate
then can set tintcolor
on uitabbar
change color of icons , text simultaneously. should still able override text appearance selectors have created though.
if recall, uitabbar
should set renderingmode
automatically, try setting tintcolor
first.
Comments
Post a Comment