My goal is simple, change the default background color of tab bar to my own color.
For example, the default looks like this
I created my own subclass of UITabBarController, so that I don't need to change the color on every UIViewController
import UIKit
class MyTabController: UITabBarController {
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.tabBar.backgroundColor = .black
}
}
The result is different from what I expected.
I thought that maybe it's the color, then I changed to a custom UIColor and the color looks exactly the same.
I tried changing the bar tint color as well, but its change the color of the icon when active, not the background
self.tabBar.tintColor = UIColor(red:1.00, green:0.23, blue:0.19, alpha:1.0)
The result will be
What did I do wrong?