下面提到的代码用于删除特定行
- (void)tableView:(UITableView *)tableView commitEditingStyle: (UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (editingStyle == UITableViewCellEditingStyleDelete) {
// Delete the row from the data source
// You need to remove
NSDictionary *contact = [[self.sections valueForKey:[[[self.sections allKeys] sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)] objectAtIndex:indexPath.section]] objectAtIndex:indexPath.row];
NSLog(@"contact %@",contact);
[self.sections removeObjectForKey:contact];
NSLog(@"%@",self.sections);
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
// crashing at above line of code and shows error message see at the bottom of the post
}
}
从上面的代码我可以正确加载UITableview但我的应用程序崩溃了 当我试图从commitEditingStyle:方法中删除?
错误消息: 2013-05-13 15:13:33.353索引TableView Final [1372:207]断言失败 - [UITableView _endCellAnimationsWithContext:],/ SourceCache / UIKit_Sim / UIKit-1912.3 / UITableView.m:1046