我在 UITableview 中有一个自动调整大小的单元格。我使用 AutoLayout 和 UITableViewAutomaticDimension 作为行高。
它适用于所有情况,甚至对于很长的文本(Lorem ipsum 的 2000 个单词)也是如此。
但是当我设置一个非常长的文本时,例如Lorem Ipsum 的 5000 个单词,我的文本在末尾被截断,日志如下
This NSLayoutConstraint is being configured with a constant that exceeds internal limits. A smaller value will be substituted, but this problem should be fixed. Break on BOOL _NSLayoutConstraintNumberExceedsLimit(void) to debug. This will be logged only once. This may break in the future.
这是我的限制。
以前有人遇到过这个问题吗?此问题的解决方法是什么。
最佳答案
您已经超过了 UILabel
能够容纳的最大尺寸(令人烦恼的是,Apple 的文档中没有对此进行定义)。如果您需要那么长的文本,您应该使用 UITextView
。要使其行为与 UILabel
相同,请确保设置 isEditable = false
。
关于ios - 在 UITableview 内的自动调整大小的标签上设置非常非常长的文本会破坏 NSLayoutConstraint,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52706274/