Darth Vader Darth Vader - 2 years ago 156
Swift Question

Changing the background color of Tab Bar

I am trying to get desired color rendered in the background of Tab Bar however I am facing problems.
These are the things that I tried :-

  1. Changing the background color of tab bar object from storyboard. The color rendered is always lighter than the desired color.

  2. Programmatically changing the color of the tab bar using the following code inside

    self.tabBar.translucent = false
    self.tabBar.backgroundColor = UIColor(hexString: "323B61")

    It doesn't change the color. Instead , the color rendered is white.

How can I get the desired color for Tab Bar?

Answer Source

To change background colour of UITabBar

TabBarController* Tcontroller =(TabBarController*)self.window.rootViewController;
Tcontroller.tabBar.barTintColor=[UIColor yourcolour];
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download