gpt4 book ai didi

ios - 在 UITableview 内的自动调整大小的标签上设置非常非常长的文本会破坏 NSLayoutConstraint

转载 作者:行者123 更新时间:2023-11-30 11:06:07 25 4
gpt4 key购买 nike

我在 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.

这是我的限制。

enter image description here

以前有人遇到过这个问题吗?此问题的解决方法是什么。

最佳答案

您已经超过了 UILabel 能够容纳的最大尺寸(令人烦恼的是,Apple 的文档中没有对此进行定义)。如果您需要那么长的文本,您应该使用 UITextView。要使其行为与 UILabel 相同,请确保设置 isEditable = false

关于ios - 在 UITableview 内的自动调整大小的标签上设置非常非常长的文本会破坏 NSLayoutConstraint,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52706274/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com