xcode 使用 TabBar 问题限制底部布局指南
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21850831/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Constraint to bottom layout guide with TabBar issue
提问by Martin Koles
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.
我有基于 UITabBarController 的 iPad 应用程序,在第一个选项卡上带有 containerView。containerView 具有到底部布局指南的标准垂直间距。当我点击第二个选项卡然后返回第一个选项卡时,我的容器向下移动 56 pts,即 tabBar 的高度,然后被 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?
我制作了 3 个屏幕截图来说明这一点。第三个屏幕截图显示了选项卡之间跳转后隐藏的 tabBar。看起来底部布局指南下降到边缘。这里发生了什么?
回答by Nicolas Bonnet
I'm not sure about what happened here, but I think that this could help:
我不确定这里发生了什么,但我认为这可能会有所帮助:
Uncheck Under bottom bar in your UIViewController properties
在 UIViewController 属性中取消选中底部栏下
Hope that will help!
希望这会有所帮助!
回答by toddg
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.
Nicolas Bonnet 取消选中“Extend Edges Under Bottom Bar”的回答对我不起作用。就我而言,问题似乎是我将视图的底部约束设置为等于底部布局指南。
So, instead, I aligned the bottom edges of my button and the ViewController's view as shown below.
因此,相反,我将按钮的底部边缘和 ViewController 的视图对齐,如下所示。
Select both your view to pin to the bottom and the main view:
选择要固定到底部的视图和主视图:
Then tap the Align selection menu at the bottom right of Interface Builder and select Bottom Edges:
然后点击 Interface Builder 右下角的 Align 选择菜单并选择 Bottom Edges: