【发布时间】:2019-12-11 01:06:45
【问题描述】:
当我删除 section 中的最后一项时,此部分中的页脚可见。我怎么能隐藏它?
我用来删除tableView.deleteRows(at: [indexPath], with: .fade),而不是tableView.reloadData()
func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
guard editingStyle == .delete else { return }
guard let section = ComistType.init(rawValue: indexPath.section) else { return }
taskList[section]?.remove(at: indexPath.item)
if taskList[section]?.count == 0 {
taskList.removeValue(forKey: section)
}
tableView.deleteRows(at: [indexPath], with: .fade)
}
'NSInternalInconsistencyException',原因:'无效更新:无效 节数。表格视图中包含的节数 更新后 (2) 必须等于所包含的节数 在更新前的表视图中(3),加减数 插入或删除的部分(0 插入,2 删除)。'
【问题讨论】:
-
你有没有试过在需要的时候使用
tableView.deleteSections(),这样就没有'空白部分'了? -
我有一个错误。查看堆栈跟踪上层
标签: ios swift uitableview uikit