I have created the tabBarController programmatically and I want to change color of tint color of images (not the bar) that tab contains. Can anyone tell me how to do that in Swift?
tintColor is a variable in UIView that returns a color. The color returned is the first non-default value in the receiver's superview chain (starting with itself). If no non-default value is found, a system-defined color is returned (the shiny blue you always see).
In your 'application:didFinishLaunchingWithOptions'
(window?.rootViewController as! UITabBarController).tabBar.tintColor = UIColor.red
or use appearance delegate.
UITabBar.appearance().tintColor = UIColor.red
Another good solution:
Add Runtime Color attribute named "tintColor".
It will change image tint color as well as title tint color.
Go to AppDelegate.swift file. In 'application:didFinishLaunchingWithOptions' write:
UITabBar.appearance().unselectedItemTintColor = UIColor.red
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With