[英]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. 我需要将UITextView
的行数限制为2,并将椭圆添加到任何溢出文本。 How would I do that? 我该怎么办? For some implementation reasons I cannot use UILabel
. 出于某些实现原因,我无法使用UILabel
。
You can do that by setting the properties of the textContainer
like so: 你可以通过设置textContainer
的属性来做到这一点:
textView.textContainer.maximumNumberOfLines = 2
textView.textContainer.lineBreakMode = .byTruncatingTail
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.