UILabel is not auto-shrinking text to fit label size

后端 未结 17 610
感动是毒
感动是毒 2020-12-04 06:53

I have this strange issue, and im dealing with it for more than 8 hours now.. Depending on situation i have to calculate UILabels size dynamically,
e.g

17条回答
  •  北海茫月
    2020-12-04 07:48

    In iOS 9 I just had to:

    1. Add constraints from the left and right of the label to the superview.
    2. Set the line break mode to clipping in IB.
    3. Set the number of lines to 1 in IB.

    Someone recommended setting number of lines to 0, but for me this just made the label go to multiple lines...

提交回复
热议问题