Search code examples
swiftuitabbarcontrolleruitabbar

UITabBar isTranslucent adds an additional UITabBar?


I'm experiencing something very strange. If the property of my UITTabBar isTranslucent is set to false, it adds this weird double like (or a view? I don't know what it is really) above of the UITabBar.

tabBarController?.tabBar.isTranslucent = false

If this property is set to true, the problem disappears. And it makes no sense.

This is the effect I see if it's set to false

enter image description here


Solution

  • You haven't given a lot of context here, but I was faced with a similar problem and found a solution.

    It's actually not the toolbar becoming higher, but the view above it not extending all of the way down to the tab bar. Now I don't know if you are using Storyboards or doing this programatically. In the child view of the UITabBarController you need to set Extend Edges -> Under Opaque Bars in the Storyboard or the property extendedLayoutIncludesOpaqueBars if you are doing it in code.

    If you build this up with the storyboard, you can actually see the extra gap if you use an Opaque Tab Bar for your simulated metric on the Bottom Bar.