samir samir - 1 year ago 85
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?

Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download