Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 537
hzwzw Avatar asked Oct 12 '15 08:10

hzwzw


2 Answers

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.

like image 77
hzwzw Avatar answered Nov 10 '22 04:11

hzwzw


I would say that adding this code in viewDidLoad of your viewController will solve your issue:

    edgesForExtendedLayout = .all
    extendedLayoutIncludesOpaqueBars = true

Plus you can keed your tabBar translucent and not set any background color.

like image 4
Adam Studenic Avatar answered Nov 10 '22 05:11

Adam Studenic