delete row UITableView index issue

前端 未结 11 1717
遥遥无期
遥遥无期 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:46

    Use Apple's Code

    The table view behaves the same way with reloading methods called inside an update block—the reload takes place with respect to the indexes of rows and sections before the animation block is executed. This behavior happens regardless of the ordering of the insertion, deletion, and reloading method calls.

    [tv beginUpdates];
    [tv deleteRowsAtIndexPaths:deleteIndexPaths withRowAnimation:UITableViewRowAnimationFade];
    [tv endUpdates];
    

提交回复
热议问题