delete row UITableView index issue

前端 未结 11 1714
遥遥无期
遥遥无期 2021-02-13 04:24

I\'m using the code below to delete a row in my tableview. First I delete the object from my array and then from the tableview using this code:

let i = IndexPath         


        
11条回答
  •  既然无缘
    2021-02-13 04:34

    After delete the row, reload particular row

    let indexPath = IndexPath(item: rowNum, section: 0)
    array.remove(at: rowNum)
    tableView.beginUpdates()
    myTableView.deleteRows(at: [i], with: UITableViewRowAnimation.automatic)
    tableView.endUpdates()
    self.tableView.reloadRows(at: [indexPath], with: .automatic)
    

提交回复
热议问题