查看约束优先级的方法

1     for (UIView* subview in self.underView.subviews) {
2         for ( NSLayoutConstraint *constraint in subview.constraints) {
3             NSLog(@"constraint:%@====>%f",constraint,constraint.priority);
4         }
5     }

1>由于在 Xcode autolayout 布局时,在 IB 中查看约束的优先级很费劲,可以通过以上代码打印出来,快速找到高优先级或低优先级的约束.

2>另外,在 IB 中,约束的优先级如果不是1000,约束的长方形框会变成虚线.

原文地址:https://www.cnblogs.com/lz465350/p/5168410.html