views:

464

answers:

1

I have a tableView that I want to allow editing and delete rows. I make it go into editing mode fine. But when I press the delete button it's not firing off the event to make it delete the row!?? Here is my code:

- (IBAction)editTable:(id)sender{

;

if(self.editing){
 [super setEditing:NO animated:NO];
 [self.tableView setEditing:NO animated:NO];
 [self.tableView  reloadData];
 [self.navigationItem.rightBarButtonItem setTitle:@"Edit"];
 [self.navigationItem.rightBarButtonItem setStyle:UIBarButtonItemStylePlain];
}else{
 [super setEditing:YES animated:YES];
 [self.tableView  setEditing:YES animated:YES];
 [self.tableView  reloadData];
 [self.navigationItem.rightBarButtonItem setTitle:@"Done"];
 [self.navigationItem.rightBarButtonItem setStyle:UIBarButtonItemStyleDone];
}

}

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

NSLog(@"HIT THIS BABY");
NSUInteger row = [indexPath row];
[accountsArray removeObjectAtIndex:row];
[self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];

}

A: 

I found it...so simple... I just ran this together:

editingStyleforRowAtIndexPath

it should have been

editingStyle forRowAtIndexPath
Xcoder