Evgeny
Evgeny

Reputation: 641

UILabel: 2 lines text shrinking

By design (!) I have two lines title text which I cannot break:

JustWord
VeryLongWordWithoutSpaces

On big iPhones (6 and 6 Plus) text works great,
but when I test on smaller iPhone (5 or less) it looks like:

JustWord
VeryLongWordWi...

I cannot find a way how to shrink the text in UILabel.
Cutting and truncating are not possible in my situation.

Requirements:
Auto Layout, no Storyboards, Swift 2.0, iOS 8.0+

Upvotes: 0

Views: 80

Answers (2)

Prakash
Prakash

Reputation: 157

Please try adjustsFontSizeToFitWidth: property for UIlabel. I have tried this and font is setting in one line and font size is automatically adjust.

Upvotes: 1

NRitH
NRitH

Reputation: 13893

The two principal ways to do this are to set a minimum font size or a minimum font scale.

Upvotes: 1

Related Questions