Reputation: 3907
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?
Upvotes: 24
Views: 22354
Reputation: 474
All above answers are right here I am sharing to achieve this using story board inspector
select your tab bar go to inspector and change image tint to your corresponding colour for reference attaching image
Upvotes: 0
Reputation: 21
Go to AppDelegate.swift file. In 'application:didFinishLaunchingWithOptions' write:
UITabBar.appearance().unselectedItemTintColor = UIColor.red
Upvotes: 2
Reputation: 7459
Another good solution:
Add Runtime Color attribute named "tintColor".
It will change image tint color as well as title tint color.
Upvotes: 14
Reputation: 5888
In your 'application:didFinishLaunchingWithOptions'
(window?.rootViewController as! UITabBarController).tabBar.tintColor = UIColor.red
or use appearance delegate.
UITabBar.appearance().tintColor = UIColor.red
Upvotes: 61