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
.
How to add ellipses on a UITextView?
Asked Answered
You can do that by setting the properties of the textContainer
like so:
textView.textContainer.maximumNumberOfLines = 2
textView.textContainer.lineBreakMode = .byTruncatingTail
If the size of the view is right textView.textContainer.lineBreakMode = .byTruncatingTail is enough. –
Saury
© 2022 - 2024 — McMap. All rights reserved.