我试图通过滑动手指(如最近调用)来删除tableView
上的单元格。我知道我需要实现:如何删除手指在iPhone上滑动的单元格
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
NSArray *index = [[NSArray alloc]initWithObjects:indexPath];
[self.tableView deleteRowsAtIndexPaths:index withRowAnimation: UITableViewRowAnimationNone];
}
但是,当我滑动手指,我得到这个功能和第二排,当我试图删除单元格的得到错误:
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of rows in section 0. The number of rows contained in an existing section after the update (4) must be equal to the number of rows contained in that section before the update (4), plus or minus the number of rows inserted or deleted from that section (0 inserted, 1 deleted).
有人可以帮忙吗?