I have Tab Bar Controller with few tabs.
All tab items should have same non-selected color for image and text.
All tab items should have different selected color for image and text.
I am ready to create images with colors needed for selected and non-selected items. And I know how to change this colors for all tabs from AppDelegate
UITabBar.appearance().tintColor = UIColorFromRGB(rgbValue: MY_COLOR, aplhaValue: 1.0)
UITabBarItem.appearance().setTitleTextAttributes([NSForegroundColorAttributeName: UIColorFromRGB(rgbValue: MY_COLOR, aplhaValue: 1.0)], for: UIControlState.selected)
UITabBarItem.appearance().setTitleTextAttributes([NSForegroundColorAttributeName: UIColor.white], for: UIControlState.normal)
But I want to make different colors for different items.
In your Storyboard select your TabBarController and give it a custom class:
TabBarController
in this example:And then create the custom TabBarController file:
It is also important that in your Assets.xcassets folder you select the each image you are using for your TabBarItem and set them to
Render As: Template Image
. That's how you can simply change its tintColor to whatever you like: