如何在表视图单元格中使用摘要元素作为标签?
我的自定义单元格中有标签。我用表格视图显示该单元格。现在我的问题是,当标签文本比单元格宽度更宽时,文本跨单元格宽度更宽。那么如何总结该文本,以便在足够长度的文本显示后......如何做到这一点? 提前致谢..
I have label in my custom cell. That cell i have display with a table view. Now i have problem is that when text of label is more wider than cell width then text cross cell width. So how summarize that text so that after a sufficient length text show .... How do that?
Thanks in advance..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果只有一行,您还可以使用
缩小字体大小以适合文本。只要必要的字体大小不小于标签的
minimumFontSize
属性,此操作就有效。If you have only one line, you can also use
to reduce the size of the font to fit the text. This will work as long as the necessary font size is not less than the label's
minimumFontSize
property.您可以使用 UILabel 并将其框架设置为您希望显示文本的矩形。您可以设置 numberOfLines 属性。文本末尾将自动为您截断并替换为“...”。
You can use a UILabel and set its frame to the rectangle that you would like the text to be displayed. You can set the numberOfLines property. The end of the text will be automatically truncated for you and replaced with "..." .
对您的标签执行此操作
Do this to your label