1

下面提到的代码用于删除特定行

- (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 Indexed TableView Final[1372:207] Assertion failure in -[UITableView _endCellAnimationsWithContext:], /SourceCache/UIKit_Sim/UIKit-1912.3/UITableView.m:1046

4

0 回答 0