How to change UITabBar background color?

31 views Asked by At

I have been following tutorials and it seems that when the instructor set up the tabbar, it automatically has color. This tutorials was made in different xcode version, so It could be why it shows the different result.

enter image description here

As you can see, the background color and the tabbar background color is the same.

What I want is

enter image description here

I just put the tabbar background color to light gray. Is this how it is supposed to be done or am I missing something?

enter image description here This is what I am expecting

1

There are 1 answers

1
arcobaleno On BEST ANSWER

In viewDidLoad(), add:

let backgroundColor = UIColor.gray
if let tabBar = self.tabBarController?.tabBar {
    tabBar.barTintColor = backgroundColor
}