gpt4 book ai didi

ios - 保持一些单元格高度不变,同时改变其他的

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

我有一个静态单元格的 TableView(具有不同的高度),我试图在加载时隐藏一个单元格。我通过使用 heightForRowAtIndexPath 并为我要关闭的单元格返回 0 来实现它,但是,对于该函数,我需要返回一个值..

override func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
if indexPath.section == 2 && indexPath.row == 5 {
return 0
}

// here:

return tableView.rowHeight // changes default values of cells
return UITableViewAutomaticDimension // changes too.

}

我想返回单元格的任何高度。

我为 obj-c 找到了这个,我觉得它可以工作,但我不确定..我无法翻译它..

[super tableView:tableView heightForRowAtIndexPath:indexPath];

保持单元格高度的方法是什么?我应该对所有内容进行硬编码吗?

最佳答案

只需调用super实现即可:

return super.tableView(tableView, heightForRowAtIndexPath: indexPath)

关于ios - 保持一些单元格高度不变,同时改变其他的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36946951/

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