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 |
Height Width | 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. |
Top Bottom Baseline | The values increase as you move down the screen. | These attributes can be combined only with Center Y, Top, Bottom, and Baseline attributes. |
Leading Trailing | 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. |
Left Right | 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 |
Center X Center 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. |
------------------越是喧嚣的世界,越需要宁静的思考------------------ 合抱之木,生于毫末;九层之台,起于垒土;千里之行,始于足下。 积土成山,风雨兴焉;积水成渊,蛟龙生焉;积善成德,而神明自得,圣心备焉。故不积跬步,无以至千里;不积小流,无以成江海。骐骥一跃,不能十步;驽马十驾,功在不舍。锲而舍之,朽木不折;锲而不舍,金石可镂。蚓无爪牙之利,筋骨之强,上食埃土,下饮黄泉,用心一也。蟹六跪而二螯,非蛇鳝之穴无可寄托者,用心躁也。