使在界面生成器,而不是code。使用自动布局视图包含填充的UIView [英] Make UIView fill containing view using auto layout in Interface Builder instead of code
问题描述
我如何使用自动布局,使子视图填补其母公司,或至少其固定所有边缘到父视图的边缘?
How do I use auto-layout to make a child view fill its parent, or at least anchor all its edges to the parent view's edges?
我使用间距为近邻所有四个垂直和水平的限制,但是当我运行一个3.5设备上的应用程序,视图的高度还没有被自动从568到480的预期调整。
I am using all four vertical and horizontal constraints in "Spacing to nearest neighbour", but when I run the app on a 3.5" device, the height of the view has not been automatically adjusted from 568 to 480 as expected.
推荐答案
针顶部空间的SuperView,底部空间的SuperView,导致空间的SuperView和尾部空间,上海华。
Pin the top space to superview, bottom space to superview, leading space to superview and trailing space to superview.
然后设置编辑的约束,像这样:
Then set edit the constraints like so:
Superview.Top> = View.Top
和 Superview.Bottom> = View.Bottom
这篇关于使在界面生成器,而不是code。使用自动布局视图包含填充的UIView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!