reloadRowsAtIndexPaths:withRowAnimation: crashes my app

后端 未结 8 1991
谎友^
谎友^ 2021-02-07 01:33

I got a strange problem with my UITableView: I use reloadRowsAtIndexPaths:withRowAnimation: to reload some specific rows, but the app crashes with an seemingly unre

8条回答
  •  花落未央
    2021-02-07 01:51

    THIS IS OLD. DO NOT USE. I just bumped into this issue when I was calling reloadRowsAtIndexPaths... in order to change the cell to an editing cell containing a UITextField. The error told me I was deleting all of the rows in the table. To solve the problem, I removed:

    [self.tableView beginUpdates];
    NSArray *reloadIndexPath = [NSArray arrayWithObject:[NSIndexPath indexPathForRow:count inSection:section]];
    [self.tableView reloadRowsAtIndexPaths:reloadIndexPath withRowAnimation:UITableViewRowAnimationFade];  
    [self.tableView endUpdates];
    

    and replaced it with

    [self.tableView reloadData];
    

提交回复
热议问题