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];
}