The background is missing on my tab bar on iOS 7 in some cases. See screen shot:
I've subclassed UITabBarController and presented my subclass modally like so:
[self.navigationController presentViewController:tabBarController animated:NO completion:nil];
Sometimes, though it's rare, the background just doesn't show up on my tab bar, and I can see right through it. No translucent view - just transparency...
I've debugged using the excellent Reveal app and found that when I observe the problem, the _UITabBarBackgroundView is missing from the UITabBar at runtime (it should be a subview of UITabBar). And in case it's worth noting, the UIImageView is also missing from the UITabBar when the background is missing.
I'm at a loss. What could be causing the tab bar to be missing its _UITabBarBackgroundView subview?
According to the documentation, you should never use a tab bar controller for anything other than the root view controller of your window:
When deploying a tab bar interface, you must install this view as the root of your window. Unlike other view controllers, a tab bar interface should never be installed as a child of another view controller.
It's not unreasonable to assume that presenting it modally, as you are doing, is going to have some unexpected side effects in some cases. Have you ever seen this issue when using the tab bar as the root controller of your app?
I've had "invisible" tab bars as shown in your screenshot, but only when I've tried to be clever when setting the background image, but you've said that isn't happening with your code.
Shot in the dark: Did you override layoutSubviews without calling super?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With