什么是“使用标准值和约束到边距”自动布局意味着什么? [英] What does "Use standard value and Constrain to Margins" mean in Auto Layout?

查看:169
本文介绍了什么是“使用标准值和约束到边距”自动布局意味着什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经阅读了几个自动布局教程,例如,通常约为10分。



当前画布值副本你如何拥有当前在画布上显示的对象的值。



手动值是你想要的任何值。







约束边际复选框有什么作用?


这会限制容器视图的边距而不是边缘。来自文档


容器视图的水平和垂直约束可以是边距或边缘。边距对应于UIView的layoutMargins atttribute中的值并指定推荐容器视图边缘与子对应边缘之间的最小距离。


您可以使用 layoutMargins property 。







对齐做什么?


这会创建一个约束,即一个视图的边或中心应与边或分对齐呃另一种观点。例如,在一列文本视图中,您可能希望每个文本字段的前导和后边对齐。


I have gone through a couple of Auto Layout tutorials such as this. However I am still not clear on what the following options do in the pin dialog

  1. What are the differences between standard value, manual values, and canvas values?

  2. What does the constrain to margin checkbox do?

  3. What does align do?

解决方案

What are the differences between standard value, manual values, and canvas values?

Standard value uses "the recommended spacing for constraints that specify distance between items", which is usually around 10 points.

Current canvas value copies the value from how you have the objects currently displayed on the canvas.

Manual values are whatever you want.


What does the constrain to margin checkbox do?

This constrains to a container view's margins instead of its edges. From the docs:

"Horizontal and vertical constraints to a container view can be to the margin or to the edge. Margins correspond to the values in the layoutMargins atttribute of UIView and specify recommended minimal distances between an edge of a container view and the corresponding edge of a child."

You can set a view's margins using the layoutMargins property.


What does align do?

This creates a constraint that edges or center of one view should be aligned with edges or center of another view. For example, in a column of text views, you might want every text field to have their leading and trailing edges aligned.

这篇关于什么是“使用标准值和约束到边距”自动布局意味着什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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