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
.
You can do that by setting the properties of the textContainer
like so:
textView.textContainer.maximumNumberOfLines = 2
textView.textContainer.lineBreakMode = .byTruncatingTail
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With