gpt4 book ai didi

ios - 无法在 tableView 中多行显示 UILabel

转载 作者:行者123 更新时间:2023-11-28 11:45:44 26 4
gpt4 key购买 nike

我有一个带有两个标签的 tableView 单元格,如下所示。这些标签的约束可以在图像中看到。

enter image description here enter image description here

对于每个标签,我都将行数设置为0并将换行符选项设置为自动换行 .但是,当加载 tableView 时,文本会显示在一行中,如下所示。

enter image description here

可能是什么导致了这个问题?

最佳答案

这可能是因为它采用了 UITableViewCell 的自定义高度

请设置estimatedRowHeightrowHeight = UITableViewAutomaticDimension

tableView.estimatedRowHeight = 100
tableView.rowHeight = UITableViewAutomaticDimension

它会解决你的问题

谢谢!!!

关于ios - 无法在 tableView 中多行显示 UILabel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52602898/

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