UILabel对齐:显示“...”在最后
在我的应用程序中,我为 uilabel 分配固定的宽度和高度,并为其分配一些文本。我的问题是,如果文本长度大于标签高度,我想在文本末尾显示“...”,例如“apple...”。有这样的房产可以展示吗?
In my app I am assigning fixed width and height to uilabel and assigning some text to it. My problem is if the text length is more than the label height I want to show "..." at the end of the text eg "apple... " . Is there is any property to show like this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,请检查换行属性并将其设置为 truncateTail
label.lineBrakMode = UILineBreakModeTailTruncation;
Yes, please check the line break property and set it to truncateTail
label.lineBrakMode = UILineBreakModeTailTruncation;
希望这有帮助,
使用 MySTRingSize 设置标签的框架。并使用 nemberOfLines 属性作为标签,这可能会有所帮助。
Hope this helps,
use MySTringSize to set the frame for label. And use nemberOfLines property for label, it might be helpfull.