Khoury
Khoury

Reputation: 431

How to shrink text to fit when single words are too long for a UILabel width in Xcode

I have a square UILabel that will show one word only. However, when that word is too long, it cuts off the word, instead of shrinking it down to fit.

How do I get the UILabel to shrink to fit a single word?

Thanks.

Upvotes: 0

Views: 295

Answers (1)

Ramkrishna Sharma
Ramkrishna Sharma

Reputation: 7019

You can used the AutoShrink property of UILabel. Please find the below screenshot for the same.

Screenshot

  1. Select the AutoShrink property.
  2. Click on the Minimum Font Size option
  3. Adjust any value depend on your requirement once the text will shrink.

Please refer the below GIF represenation.

GIF

Hope it works for you!!!

Upvotes: 2

Related Questions