Changing the background color of Tab Bar
Solution 1:
To change background colour of UITabBar
TabBarController* Tcontroller =(TabBarController*)self.window.rootViewController;
Tcontroller.tabBar.barTintColor=[UIColor yourcolour];
Swift 3
Based on the code above, you can get it by doing this
let Tcontroller = self.window.rootViewController as? UITabBarController
Tcontroller?.tabBar.barTintColor = UIColor.black // your color
or in more general
UITabBar.appearance().barTintColor = UIColor.black // your color
Solution 2:
We can also do it from Storyboard
1) Select the Tab Bar first:
2) Then from the Attribute Inspector choose Bar Tint colour as shown in the below image:
That's it!
Solution 3:
swift 4
Inside your UITabBarController
tabBar.barTintColor = .purple
tabBar.isTranslucent = false
You also have access to:
tabBar.tintColor = .green
tabBar.unselectedItemTintColor = .blue
to change icon colours if you want.