UILabel height calculation

后端 未结 2 706
迷失自我
迷失自我 2021-01-15 15:53

I have UILabel that the text is dynamically change based on server data. Sometime the data is so long that make my UILabel become multiline. Is the

2条回答
  •  清酒与你
    2021-01-15 16:09

    If you are using Autolayout then no need to calculate height, just add leading,top and trailing constraint, set number of line to 0 for that label and line break mode to word-wrap, it will automatically update its height.

    P.S. Add the bottom contraints too if there is any other control in nib after label.

提交回复
热议问题