【发布时间】:2011-05-20 14:00:19
【问题描述】:
大家好
我正在使用以下代码删除 rgouped 表视图中的一行
- (void)tableView:(UITableView *)tv commitEditingStyle:(UITableViewCellEditingStyle)editingStyle
forRowAtIndexPath:(NSIndexPath *)indexPath {
if(editingStyle == UITableViewCellEditingStyleDelete) {
//Get the object to delete from the array.
insertUpdateDelete *objInsertUpdateDelete = [appDelegate.arrObjects objectAtIndex:indexPath.row];
[appDelegate DeleteRecord:objInsertUpdateDelete];
//Delete the object from the table.
[tableView1 deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
}
}
}
但它在生产线上崩溃了
[tableView1 deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
崩溃日志是:
2011-05-20 19:21:20.233 iICS[10744:207] * 断言失败 在 -[UITableView _endCellAnimationsWithContext:], /SourceCache/UIKit_Sim/UIKit-1448.89/UITableView.m:995 2011-05-20 19:21:20.235 iICS[10744:207]
*** Terminating app due to uncaught exception'NSInternalInconsistencyException', 原因:'无效更新:无效 第 0 节中的行数。 包含在一个中的行数 更新后的现有部分 (3) 必须等于行数 载于该节之前 更新(3),加减数字 从中插入或删除的行数 部分(0 插入,1 删除)。'
有朋友可以帮帮我吗?提前谢谢
【问题讨论】:
标签: iphone objective-c xcode4