(Swift) selected tabBar Color?
Change tintColor (whatever you are allowed to do)
Subclass UITabBarController, set it as the class of your UITabBarViewController:
class myOwnTBC: UITabBarController {
override func viewDidLoad() {
super.viewDidLoad()
self.tabBar.tintColor = .blueColor()
}
}
After further research following your comment:
I really believe Apple doesn't want the developer to change the background color of the UITabBar. Refer to the TabBar Interface Guide . I quote:
Tab bar: Semi-transparent
I tried subclassing the UITabBarItem and manipulating the background which gave me the following exception:
Directly change the tab bar driven by the tab bar. The controller is not allowed.
Decision?! You won't like this, but if you want to use the UITabBarController you should stick with the semi-transparent preset.
Workaround? The only workaround I can think of in Moment is: Create your own navigation using your own UIView-Subclass. This would violate interface principles anyway, but you can achieve your goal.
source to share