kishore
kishore

Reputation: 53

Append "..." at the end of fourth line

I am displaying text using UILabel. I want to display only 4 lines of text, if there is more text i have to append "..." at the end of fourth line. Any help on this is greatly appreciated. Thanks in advance.

Upvotes: 2

Views: 105

Answers (2)

βhargavḯ
βhargavḯ

Reputation: 9836

lbl.lineBreakMode = UILineBreakModeTailTruncation;
lbl.numberOfLines = 4;

For iOS >= 6,

lbl.lineBreakMode = NSLineBreakByTruncatingTail;
lbl.numberOfLines = 4;

Upvotes: 1

Gabriele Petronella
Gabriele Petronella

Reputation: 108111

label.numberOfLines = 4;
label.lineBreakMode = NSLineBreakByTruncatingTail;

or in case you support iOS <= 5.

label.lineBreakMode = UILineBreakModeTailTruncation;

Upvotes: 3

Related Questions