【发布时间】:2021-02-04 15:08:44
【问题描述】:
基本上我想在满足两个条件时在我的静态表中隐藏一个单元格:
override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
var height: CGFloat
if indexPath.row == 1 && unitImage == nil {
height = 0
} else {
height = 190
}
return height
}
问题是每个单元格在情节提要中设置了不同的高度,如果 unitImage 为空白,我真的只需要隐藏第一行。
【问题讨论】:
-
你能解释一下这个吗...故事板中每个单元格的高度不同是什么意思?你不是在运行时指定高度吗?
-
通常静态单元格由插座驱动,而不是由数据源和委托驱动。
标签: swift