Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Constraint to bottom layout guide with TabBar issue

I have UITabBarController based iPad app with containerView on the first tab. The containerView has standard vertical spacing to bottom layout guide. When I tap on the second tab and then go back to the first tab, my container moves down by 56 pts, the height of the tabBar and is then covered by the tabBar.

I made 3 screenshots to illustrate that. The third screenshot shows hidden tabBar after the jump between tabs. It looks like the bottom layout guide went down to the edge. What is going on here?

enter image description here

like image 284
Martin Koles Avatar asked Feb 18 '14 10:02

Martin Koles


People also ask

How do I hide tabBar when pushing?

You can do this in storyboard now: Select the UIViewController in your storyboard. Select the checkbox Hide Bottom Bar on Push.

What is Autolayout?

Auto Layout defines your user interface using a series of constraints. Constraints typically represent a relationship between two views. Auto Layout then calculates the size and location of each view based on these constraints. This produces layouts that dynamically respond to both internal and external changes.


2 Answers

I'm not sure about what happened here, but I think that this could help:

enter image description here

Uncheck Under bottom bar in your UIViewController properties

Hope that will help!

like image 132
Nicolas Bonnet Avatar answered Sep 28 '22 20:09

Nicolas Bonnet


Nicolas Bonnet's answer of unchecking "Extend Edges Under Bottom Bar" didn't work for me. In my case the problem seemed to be that I was setting the bottom constraint of my view equal to the Bottom Layout Guide.

So, instead, I aligned the bottom edges of my button and the ViewController's view as shown below.

Select both your view to pin to the bottom and the main view:

View Selection Image

Then tap the Align selection menu at the bottom right of Interface Builder and select Bottom Edges:

enter image description here

like image 25
toddg Avatar answered Sep 28 '22 20:09

toddg