Husam
Husam

Reputation: 8568

UILabel word wrap preventing

I have a label with about two lines of text, the problem is that the word is getting wrapped instead of getting smaller to fit the fixed width and fixed height !

enter image description here

Any idea on how to fix that programmatically will be appreciated. Thank you

Upvotes: 3

Views: 1455

Answers (1)

user4657588
user4657588

Reputation:

Just set the font to readjust its size according to the label width like so:

labelName.numberOfLines = 1;
labelName.adjustsFontSizeToFitWidth = YES;

Upvotes: 1

Related Questions