Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add ellipses on a UITextView?

I need to restrict number of lines in a UITextView to 2 and add ellipses to any overflowing text. How would I do that? For some implementation reasons I cannot use UILabel.

like image 870
Suchi Avatar asked Jul 25 '15 17:07

Suchi


1 Answers

You can do that by setting the properties of the textContainer like so:

textView.textContainer.maximumNumberOfLines = 2
textView.textContainer.lineBreakMode = .byTruncatingTail
like image 53
Artal Avatar answered Nov 14 '22 05:11

Artal