gpt4 book ai didi

ios - 在 Today Extension 中使用时 tableview.contentSize 错误

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

我开发了一个在 TableView 中显示数据的“Today Extension”。在此表中使用动态大小自动计算单元格的高度。

然后设置today扩展的preferredContentSize:

self.preferredContentsize = self.tableView.contentSize

事实是 tableView.contentSize 返回了一个不正确的值。

在我的 Storyboard 中,我确定正确地设置了约束。

我可以尝试什么?

最佳答案

为 top-bottom-left-right 设置所有引脚约束。

转到 Storyboard -> 选择 UITableViewCell,然后点击 Storyboard 右下角的 Pin 按钮。

选择所有四个引脚约束,如下图所示,然后点击添加 4 个约束

enter image description here

编辑:

您也可以对 xib 文件执行相同的操作。这是自动调整概念。

选择 .xib 文件中的单元格,打开右侧的实用程序面板,单击“显示尺寸检查器”。

检查下图,您可以看到四个箭头与自动布局中的标记相同。通过这样做,您可以像上面那样实现。

enter image description here

关于ios - 在 Today Extension 中使用时 tableview.contentSize 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28046501/

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