samir samir - 3 months ago 7x
Objective-C Question

UILabel Truncation

I have text like this: "My text is blabla blabla, lala lala ".

I would like to have the text in my

like this: "My text is ...lala".

How can I configure my
to display the text to have the ellipsis in the middle?


The word you are looking for is "ellipsis" ;)

Set the following properties:

label.adjustsFontSizeToFitWidth = NO;
label.lineBreakMode = UILineBreakModeMiddleTruncation;

You can also set these properties in interface builder.

Example stolen from here: Getting UILabel to produce an ellipsis rather then shrinking the font