How to reload programmatically moved row?

后端 未结 4 1213
别跟我提以往
别跟我提以往 2021-01-11 14:34

Frustrating fact: After calling tableView:moveRowAtIndexPath:toIndexPath:, tableView:cellForRowAtIndexPath: doesn\'t get called for that row.

4条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-11 14:53

    [_tableview beginUpdates];
    
    // write code here to delete and move row...
    
    [_tableview endUpdates];
    
     // now after end update call reload method to reload cell..  
    
        [self.tableview reloadRowsAtIndexPaths:[NSArray arrayWithObjects:
        [NSIndexPath indexPathForRow:_arrayForData.count-1 inSection:indexpathforSelectedRow.section], nil] withRowAnimation:UITableViewRowAnimationNone];
    

提交回复
热议问题