在使用Autolayout时有时候会有莫名其妙的错误,是因为UIView是默认同时开启Autoresizing和Autolayout的。

但我们的Autolayout很容易和Autoresizing冲突,所以一般我们在使用Autolayout时要手动关闭Autoresizing。

方法为:

[self.view setTranslatesAutoresizingMaskIntoConstraints:NO];

版权声明:本文为zeyang原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/zeyang/p/4433755.html