Search code examples
iosios7uinavigationcontrolleruitabbarcontrollersetbackground

UINavigationController inside UITabBarController - Change UITabBar background color


I have a problem changing the background color of my UITabBar. I have a UITabBarController and UINavigationController inside one with a root view.

Tab Bar Controller > Navigation Controller > Root View

enter image description here

In UITabBarController class I have the following code:

[self.UITabBarHome setBackgroundColor:[UIColor greenColor]];

The color applies in my UITabBar until I click the UITabBarItem (Group) that directs to my UINavigationController. When I click this item only, the color changes to the default color.How to avoid this?


Solution

  • I solved the problem by adding a UITabBar in the root view controller of the UINavigationController