Search code examples
iosswiftuitabbar

When the UITabbar is Translucent and the UIViewController is not extended behind the tabbar, the uitabbar seems like covering a black view


This is what I want This is my problem

The tabbar in first view is what I want. Because the second view isn't a scrollview, so I can't extend it to bottom by using self.edgesForExtendedLayout = UIRectEdge.Bottom.

It looks unacceptable.

And I don't want to set Translucent of uitabbar to false, it's not fancy.

I try in another way: [[UITabBar appearance] setBarTintColor: [UIColor whiteColor]];

It doesn't work. To make it looks more clear, I change the color to red. And the last tabbar also looks like covering some black views.

OK OK


Solution

  • Consider of the tabbar is translucent, what's the view under the UITabbar view?

    This is the final answer of why it doesn't work when changing the tintcolor of bar. Because the view under UITabbar view is black.

    Thanks to the Xcode awesome debugging function. We could locate the view under UITabbar view easily.

    enter image description here

    It's UIWindow. So the solution is to simply change the window's backgroundColor to white.