LaK
LaK

Reputation: 99

UILabel.text shortening and appending "..."

I have an UILabel that I want to contain a preview of a long string. It should be a 1-line-label, and should be populated with a maximum number of Characters and then append "..." at the end of the UILabel.text. Now i could do that manually, but I'd really like to calculate all of that stuff and do it dynamically, as the label is a subview of UITableViewCell and when turning the device, it should be possible to stretch it and calculate again.

Any ideas?

P.S. Sorry for any spelling mistakes, I'm not a native speaker..

Upvotes: 1

Views: 239

Answers (1)

phi
phi

Reputation: 10733

I'm not sure if I understand your question well, but isn't this supported anyway, if you set the UILabel's lineBreakMode to UILineBreakModeTailTruncation?

enter image description here

Upvotes: 1

Related Questions