UI布局术语

horizontal, vertical

 

top, left, bottom, right

 

UIEdgeInsets

 

margin与padding

 

Interpreting Values

Values in Auto Layout are always in points. However, the exact meaning of these measurements can vary depending on the attributes involved and the view’s layout direction. 

 

Auto Layout Attributes

Value

Notes

image: ../Art/ALGuide_Height.pdfHeight

image: ../Art/ALGuide_Width.pdfWidth

The size of the view.

These attributes can be assigned constant values or combined with other Height and Width attributes. These values cannot be negative.

image: ../Art/ALGuide_TopToSuper.pdfTop

image: ../Art/ALGuide_BottomToSuper.pdfBottom

image: ../Art/ALGuide_AlignMiddle.pdfBaseline

The values increase as you move down the screen.

These attributes can be combined only with Center Y, Top, Bottom, and Baseline attributes.

image: ../Art/ALGuide_LeftToSuper.pdfLeading

image: ../Art/ALGuide_RightToSuper.pdfTrailing

The values increase as you move towards the trailing edge. For a left-to-right layout directions, the values increase as you move to the right. For a right-to-left layout direction, the values increase as you move left.

These attributes can be combined only with Leading, Trailing, or Center X attributes.

image: ../Art/ALGuide_LeftToSuper.pdfLeft

image: ../Art/ALGuide_RightToSuper.pdfRight

The values increase as you move to the right.

These attributes can be combined only with Left, Right, and Center X attributes.

Avoid using Left and Right attributes. Use Leading and Trailing instead. This allows the layout to adapt to the view’s reading direction.

By default the reading direction is determined based on the current language set by the user. However, you can override this where necessary. In iOS, set the semanticContentAttribute property on the view holding the constraint (the nearest common ancestor of all views affected by the constraint) to specify whether the content’s layout should be flipped when switching between left-to-right and right-to-left languages. 

image: ../Art/ALGuide_AlignCenter.pdfCenter X

image: ../Art/ALGuide_AlignMiddle.pdfCenter Y

The interpretation is based on the other attribute in the equation.

Center X can be combined with Center X, Leading, Trailing, Right, and Left attributes.

Center Y can be combined with Center Y, Top, Bottom, and Baseline attributes.

转载于:https://www.cnblogs.com/feng9exe/p/7930524.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值