我正在尝试根据标识符设置表格视图中每个单元格的高度。我不想使用indexPath.row,因为我正在使用包含每种类型单元格的标志的数组来填充单元格,而顺序是随机的。恰好有3种类型的单元格。
我使用了以下代码,但它导致错误:
错误出现在这一行:
谢谢你。
我使用了以下代码,但它导致错误:
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
let cell = tableV.cellForRow(at: indexPath)
if(cell?.reuseIdentifier == "homeFeaturedR"){
return 200
}else{
return 360
}
}
错误出现在这一行:
let cell = tableV.cellForRow(at: indexPath)
谢谢你。