xcode 将 view.bottom 限制为 superview.bottom 而不是故事板中的 bottomLayoutGuide
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/29021129/
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
constrain view.bottom to superview.bottom not bottomLayoutGuide in storyboard
提问by nwales
In interface builder it only gives me the option of constraining my sub view to the bottom layout guide, not the superview. Because I am sometimes using the controller as a child controller in a container controller setup, I really want to constraint to the superview bottom, not the bottom layout guide.
在界面构建器中,它只让我可以选择将我的子视图约束到底部布局指南,而不是超级视图。因为我有时在容器控制器设置中使用控制器作为子控制器,我真的想约束到超级视图底部,而不是底部布局指南。
采纳答案by Fengson
Select your TableView and go to Editor -> Pin
.
From there you have 4 options to pin to superview:
选择您的 TableView 并转到Editor -> Pin
.
从那里你有 4 个选项可以固定到超级视图:
- Leading Space to Superview
- Trailing Space to Superview
- Top Space to Superview
- Bottom Space to Superview
- 引领空间至超视
- 到 Superview 的尾随空间
- 超级视图的顶部空间
- 到超级视图的底部空间
This works as expected. The only downside is that you have to perform the pinning manually, as there are no shortcuts available.
这按预期工作。唯一的缺点是您必须手动执行固定,因为没有可用的快捷方式。
回答by Johannes Rudolph
As @Trianna Brannon pointed out, the approach in the other answerno longer works in Xcode7. In Xcode7 you have to right click your element, draw a line to the bottom until the constraint selector pops up.
正如@Trianna Brannon 指出的那样,另一个答案中的方法不再适用于 Xcode7。在 Xcode7 中,您必须右键单击您的元素,在底部画一条线,直到弹出约束选择器。
Then press ALTand now you'll get the desired Bottom constraint:
然后按下ALT,现在您将获得所需的底部约束: