xib的NSLayoutConstraint是否有效

这里的问题主要是给自己长个记性,xib添加约束,但是某些前提下,我们可能需要部分的约束失效,部分的约束有效

@IBOutlet weak var label3Top_label1Bottom: NSLayoutConstraint!

 设置有效

label3Top_label1Bottom..shouldBeArchived = true

 无效

label3Top_label1Bottom..shouldBeArchived = false

也可以使用priority解决

defaultLow低优先级别

defaultHigh高优先级别

原文地址:https://www.cnblogs.com/hualuoshuijia/p/13911024.html