删除的代理方法中实现如下:- (void)tableView:(UITableView )tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath )indexPath{
if (editingStyle == UITableViewCellEditingStyleDelete) {
NSIndexPath * path = [_businessTableview indexPathForCell:_memoryCell];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
//[self DelegateRecode:[NSString stringWithFormat:@"%@",IDArr[indexPath.row]]];
dispatch_async(dispatch_get_main_queue(), ^{
[resultArr removeObjectAtIndex:path.row];
[_businessTableview beginUpdates];
[_businessTableview deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];
_memoryCell = nil;
[_businessTableview endUpdates];
if(resultArr.count == 0){
[_businessTableview deleteSections:[NSIndexSet indexSetWithIndex:indexPath.section] withRowAnimation:UITableViewRowAnimationLeft];
}
});
});
}
}
报错如下:
2016-09-08 16:03:25.803 SUOTAO[5986:2554341] * Assertion failure in -[UITableView _endCellAnimationsWithContext:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit/UIKit-3512.60.12/UITableView.m:1716
其中:数据源是我从后台得到的数组,section 返回的是1,写的死数据。
应该是直接删section吧,你的代码似乎会在删row的时候就报错。