Description

AutoLayout provides a flexible and powerful layout system that describes how views and the UI controls calculates the size and position in the hierarchy.

Q:

以后一律使用autolayout吗?除了在storyboard中使用autolayout,代码方式autolayout如何使用?

  • 当需要展示的内容很多并且尺寸不固定;
  • 程序需支持屏幕旋转(主要是iPad程序,iPhone程序横屏的场景有点非主流)
  • 程序通用于iPhone和iPad;

Autolayout Pros & Cons

pros:可视化,实现简单功能很节省时间

cons: storyboard 使用 autolayout,移动一个控件就会让弄乱那些约束;

autolayout有没有局限性和解决不了的问题?兼容性怎么样?效率怎么样

autolayout对view transforms支持的不好,

这里详细描述了这个问题 http://stackoverflow.com/questions/12943107/how-do-i-adjust-the-anchor-point-of-a-calayer-when-auto-layout-is-being-used/14105757#14105757

至于兼容性,只从iOS6就已经提出了autolayout的概念,大部分用户应该是使用iOS7和iOS8系统,所以兼容性问题不会太大,但size class是iOS8才有的概念,所以还有有一定的适配工作量

Ref

http://www.jianshu.com/p/c12eb90b16fc

http://www.jianshu.com/p/d7a4790090f1

http://www.jianshu.com/p/10a250cc5018

http://blog.csdn.net/liangliang103377/article/details/40082255

http://shavekevin.com/2016/04/17/autolayoutsizeclasspartone/

results matching ""

    No results matching ""