Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add dots to UILabel if text does not fit frame

I have a cell with multiline UILabels, but when the text's label does not fit the frame, no dots are shown. How can I fix this?

like image 456
Timur Bernikovich Avatar asked Oct 13 '13 22:10

Timur Bernikovich


1 Answers

Have you tried this?

Prior Swift 5:

yourLabel.adjustsFontSizeToFitWidth = NO;
yourLabel.lineBreakMode = NSLineBreakByTruncatingTail;

Swift 5:

yourLabel.adjustsFontSizeToFitWidth = false
yourLabel.lineBreakMode = .byTruncatingTail

Prior iOS6 use UILineBreakModeTailTruncation

like image 91
ssantos Avatar answered Oct 13 '22 08:10

ssantos