Adjust UILabel height dynamically using iOS storyboard

I have a label that was created using the iOS layouts layout.

The content of the label, however, is dynamic and may change at runtime.

How to make sure the height of the label is adjusted based on the contents on the label.

I tried:

Setting the number of rows to 0

Editor -> Size to Fit Content settings Editor -> Size to Fit Content .

But they do not work. The text in the label is printed on only one line, and as a result, the text does not appear on the screen.

Any help would be greatly appreciated.

+7
ios xcode swift storyboard
source share
2 answers

Picture Try this way

Your line should be the number of lines up to 0

assign a height limit to the limit and select a height limit, then set more than equal , it will automatically adjust the height based on the content

+4
source share

Please check your limitations. You cannot set a tag height limit. If the height of the supervisor is fixed, you cannot set a limit on the top and bottom at the same time. Since this means that you are setting a limit on the height of the mark. This way you can fix the width of the label, and you cannot fix the height of the label.

0
source share

All Articles