How to definitively set UITabBar background color and tint color How to definitively set UITabBar background color and tint color ios ios

How to definitively set UITabBar background color and tint color


If you want to set tabbar's tint and barTint color implicitly then in your Appdelegate.swift,

    UITabBar.appearance().barTintColor = .orange    UITabBar.appearance().tintColor = .green

If you want to set tabbar's tint and barTint color for specific viewController then in ViewController.swift,

 self.tabBarController?.tabBar.tintColor = .orange self.tabBarController?.tabBar.barTintColor = .green


Set tab bar background color with barTintColor:

self.tabBar.barTintColor = UIColor.blueColor()//orUITabBar.appearance().barTintColor = UIColor.blueColor()

And for tab bar tint color:

self.tabBar.tintColor = UIColor.whiteColor() // Selected tab color//orUITabBar.appearance().tintColor = UIColor.whiteColor()

enter image description here


Swift 4+ version

UITabBar.appearance().barTintColor = UIColor.redUITabBar.appearance().tintColor = UIColor.white