masnory 宽度自适应

当 label想要宽度自适应时 加上下面的话 
“Content Compression Resistance”和“Content Hugging”

1.宽度不够时

[_label1 setContentCompressionResistancePriority:UILayoutPriorityRequired
                                         forAxis:UILayoutConstraintAxisHorizontal];
  • 1
  • 2

2.宽度够时

[label setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
  • 1

你可能感兴趣的:(masnory 宽度自适应)