How to add ellipses to UITextView?

I need to limit the number of lines in a UITextView to 2 and add ellipses to any overflowing text. How can I do it? For some implementation reasons, I cannot use UILabel .

+7
ios iphone ellipsis uitextview
source share
1 answer

You can do this by setting the textContainer properties as follows:

 textView.textContainer.maximumNumberOfLines = 2 textView.textContainer.lineBreakMode = .byTruncatingTail 
+26
source share

All Articles