Programmatically change the UITabBar Tint Color and the UITabBar Item selected and unselected icon tint color.

I assume you have deployed UITabBarViewController in your iOS App. Now you want to change the Tint color of the UITabBar, the Tint color of the UITabBar item, and the tint color of the UITabBar’s unselected icon.

Doing this is just as simple as a single line of code.

The code below will go to your Apple iOS app’s AppDelegate.swift file under the ‘didFinishLaunchingWithOptions’ function.

So your code will look something like this.

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
UITabBar.appearance().tintColor = UIColor(red: 0/255, green: 0/255, blue: 255/255, alpha: 1.0)
UITabBar.appearance().barTintColor = UIColor(red: 0/255, green: 0/255, blue: 0/255, alpha: 1.0)
UITabBar.appearance().unselectedItemTintColor = UIColor(red: 0/255, green: 255/255, blue: 0/255, alpha: 1.0)

Hope it helps,

Thanks & Regards
Mandar Apte

Published by Mandar Apte

Mandar is a Mumbai-based multi-disciplinary designer with UX/UI, Logo, Symbol, and Brand Identity design expertise. He currently runs his Mudrkashar Linguistic Apple iPhone, iPad, and Mac app business in the heart of Mumbai city.

Leave a comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.