AutoLayout在页面布局中的简单使用
2016-05-07 本文已影响22人
Roy_Gao
1.视图布局中主要使用这三个控件;

2.相当设置其相对位置,即其坐标(x,y);


3.当有红色小尖头时,意味着有冲突,或者缺少约束

4.顾名思义,就是设置长宽(width,height);

5.黄色小尖头,意味着当前的位置,和设置的位置不一样;

6.的作用,上面时更新一个控件的约束,下面一组是跟新群组控件的约束;


7.页面中的Constrain to neighbor选项,如果选中,意味着系统默认距离周围其他空间的位置;
其中,某一个约束又是相对多个周边控件中的某一个进行设置的,通过倒三角可以进行选择;



使用AutoLayout的使用注意事项:
A 关闭AutoResizing,设置view下面的该属性威NO;
B 添加约束之前,要保证相关控件已经添加到父控件上;
C 不要再设置frame