简体   繁体   English

UITableView单元格文本被截断

[英]UITableView cell text is cut off

I am having a problem with the UITableview cell cutting off strings whose characters are more than 12 chars. 我遇到的问题是UITableview单元切断了字符超过12个字符的字符串。 Any ideas why this would occur? 有什么想法会发生这种情况吗? I have not made a custom cell at all. 我根本没有自定义单元格。 I cannot find any solution to this problem through a Google search. 我无法通过Google搜索找到解决此问题的任何方法。 Any ideas? 有任何想法吗?

You should be able to set the label properties to re-size the font based on the label's contents using adjustsFontSizeToFitWidth . 您应该能够使用adjustsFontSizeToFitWidth设置标签属性,以根据标签的内容重新调整字体大小。 This will essentially decrease the font size to make the text fit all on one line. 这将基本上减小字体大小,使文本适合所有在一行。

Your cell likely contains a label, which in turn is set to given bounds. 您的单元格可能包含一个标签,而标签又设置为给定的边界。 What you need to do is ensure that your label is the same size as your longest string, or bigger than it. 您需要做的是确保您的标签与最长的字符串大小相同,或者大于它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM