iOS Autolayout - 约束修改在方向更改时丢失?
iOS Autolayout - constraints modifications lost on orientation change?
如果我修改我的约束(比如激活一些约束并停用其他约束)然后旋转到不同的方向,我的界面会快速恢复到原始未修改状态。我如何保留此更改?
你的限制是'properties of the class'吗?或者它们是函数的局部变量,在您改变方向后会被释放?
一般建议是保持 reference/pointer 约束,而不是 adding/removing 约束 activate/deactivate 约束。参见 this moment of wwdc: Mysteries of Auto Layout, Part 1
如果我修改我的约束(比如激活一些约束并停用其他约束)然后旋转到不同的方向,我的界面会快速恢复到原始未修改状态。我如何保留此更改?
你的限制是'properties of the class'吗?或者它们是函数的局部变量,在您改变方向后会被释放?
一般建议是保持 reference/pointer 约束,而不是 adding/removing 约束 activate/deactivate 约束。参见 this moment of wwdc: Mysteries of Auto Layout, Part 1