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?
Asked
Active
Viewed 2.1k times
4 Answers
61
In your 'application:didFinishLaunchingWithOptions'
(window?.rootViewController as! UITabBarController).tabBar.tintColor = UIColor.red
or use appearance delegate.
UITabBar.appearance().tintColor = UIColor.red

Sunil Targe
- 7,251
- 5
- 49
- 80

Satachito
- 5,838
- 36
- 43
-
instead of .tintColor = ... try use .barTintColor = – stosha May 01 '15 at 14:29
-
it only change selected state color – Ucdemir Dec 25 '18 at 17:03
13
Another good solution:
Add Runtime Color attribute named "tintColor".
It will change image tint color as well as title tint color.

halfer
- 19,824
- 17
- 99
- 186

Sunil Targe
- 7,251
- 5
- 49
- 80
2
Go to AppDelegate.swift file. In 'application:didFinishLaunchingWithOptions' write:
UITabBar.appearance().unselectedItemTintColor = UIColor.red

SomethingSolid
- 21
- 2
0
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

Ahmad Qasim
- 452
- 1
- 8
- 26