How to shrink long text in label with Swift?

Posted by Wei on July 9, 2017

Question

I want to show a long text in label, and it seems too long to fit. Is there any way to shrink those text into this label box?

Answer One - Storyboard

add

Change the label property Autoshrink to whichever you like.

Answer Two - Programmingly

labelName.adjustsFontSizeToFitWidth = true

In this way, you can also adjust text in the label.

Reference


This is the end of post