AutoLayout 和 autoresizing

来源:互联网 发布:淘宝店铺售假扣24分 编辑:程序博客网 时间:2024/05/16 05:55

AutoLayout 是 iOS6 发布后引入的一个全新的布局特性,其目的是弥补以往 autoresizing 在布局方面的不足,以及未来面对更多尺寸适配时界面布局可以更好的适应。

注意:如果从代码层面开始使用 AutoLayout, 需要将使用 AutoLayout 的View 的 translatesAutoresizingMaskIntoConstraints 属性设置为 NO. 即可通过代码添加 constraint,否则view还是会按照以往的 autoresizingMask 进行计算。而在Interface Builder中勾选了Ues Autolayout,IB生成的控件的translatesAutoresizingMaskIntoConstraints属性都会被默认设置NO.

0 0
原创粉丝点击