使在界面生成器,而不是code。使用自动布局视图包含填充的UIView [英] Make UIView fill containing view using auto layout in Interface Builder instead of code

查看:155
本文介绍了使在界面生成器,而不是code。使用自动布局视图包含填充的UIView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何使用自动布局,使子视图填补其母公司,或至少其固定所有边缘到父视图的边缘?

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆