【发布时间】:2021-10-30 23:36:16
【问题描述】:
我是 iOS 编码的新手。我试图删除 UITableview 中的唯一行并收到以下错误“尝试删除并重新加载相同的索引路径 (
func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
if editingStyle == .delete {
let len = displayList.count
displayList.remove(at: indexPath.row)
// self.totTableView.beginUpdates()
if displayTotList.count == len - 1{
totTableView.deleteRows(at: [indexPath], with: .automatic)
totTableView.reloadData()
}
// self.totTableView.reloadRows(at: [indexPath as IndexPath], with: UITableView.RowAnimation.automatic)
// self.totTableView.endUpdates()
}
}
【问题讨论】:
标签: ios swift uitableview tableview