Search code examples
swiftcolorsios8iconstabbarcontroller

iOS8 Swift TabBarController Change Icon Color


I'm trying to change the color of the icons in my TabBarController. I've successfully changed the textcolor (just below the icons), but cant figure out how I change the icon color.

I've changed the icon-text-color like this:

UITabBarItem.appearance().setTitleTextAttributes([NSForegroundColorAttributeName: UIColor.orangeColor()], forState:.Selected)
UITabBarItem.appearance().setTitleTextAttributes([NSForegroundColorAttributeName: UIColor.whiteColor()], forState:.Normal)

I've put this into my AppDelegate.swift (didFinishLaunchingWithOptions). Now the selected item-text is orange, and the unselected are white. The icons however are still in blue / dark gray. How do I change these?

Unselected:

Unselected

Selected:

Selected


Solution

  • Set tintColor property by UIAppearance.