原文地址:http://stackoverflow.com/questions/16009405/uilabel-sizetofit-doesnt-work-with-autolayout-ios6
Using Interface Builder
- Set up four constraints. The height constraint is mandatory.
- Then go to the label’s attributes inspector and set number of lines to 0.
- Go to the label’s size inspector and increase vertical ContentHuggingPriority and vertical ContentCompressionResistancePriority.
- Select and edit height constraint.
- And decrease height constraint priority.