Assertion failure in -[UITableView _endCellAnimationsWithContext:]

前端 未结 12 1612
走了就别回头了
走了就别回头了 2020-12-08 03:41

Hopefully this will be a quick fix. I have been trying to figure out the error that i keep getting. The error is listed below and the appdelagate is below that.

An

12条回答
  •  天命终不由人
    2020-12-08 04:15

    Don't forget to update your array which determines numberOfRowsInSection. It needs to be updated before you animate and remove

    We check if number of rows in section is 1 because we will have to delete the entire section.

    Do correct me if anyone can make this answer clearer.

    [self.tableView beginUpdates];
    if ([tableView numberOfRowsInSection:indexPath.section] == 1) {
    
       [tableView deleteSections:[NSIndexSet indexSetWithIndex:indexPath.section] withRowAnimation:UITableViewRowAnimationFade];
    } else {
    
       [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationNone];
    }
    [self.tableView endUpdates];
    

提交回复
热议问题