错误全文:
Invalid update: invalid number of rows in section 0. The number of rows contained in an existing section after the update (8) must be equal to the number of rows contained in that section before the update (8), plus or minus the number of rows inserted or deleted from that section (0 inserted, 1 deleted) and plus or minus the number of rows moved into or out of that section (0 moved in, 0 moved out).
错误原因:删除TableView Cell的时候没有删除对应的数据源!
override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath)
{
if editingStyle == .delete
{
/*
delete database record
*/
filterDishes.remove(at: indexPath.row) //delete datasource
tableView.deleteRows(at: [indexPath], with: .fade)
}
}
注意事项:绑定tUITableView的数据源要根据实际情况加以删除