0

因此,在我的 viewDidLoad 方法中,我调用了:

self.navigationItem.rightBarButtonItem = self.editButtonItem;

然后稍后在我的 tableView:commitEditingStyle:forRowAtIndexPath: 我这样做:

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {

if (editingStyle == UITableViewCellEditingStyleDelete) {   
    [self.list removeObjectAtIndex:indexPath.row];
    [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
}

}

但是,当我在 tableView 中删除一行时,在实际运行应用程序时,我在对列表的 removeObjectAtIndex 调用中抛出异常。我试着把它拿出来,但后来我在 tableView deleteRowsAtIndexPaths:withRowAnimation 上抛出了另一个异常:

请帮忙!提前致谢!

4

1 回答 1

0

self.list需要是一个NSMutableArray.

于 2012-06-23T21:34:29.033 回答