Unable to Delete Rows


#1

Followed the directions and added the following method to ItemsViewController.m, but it’s not getting called. Is there something else that I need to do? I’m running using the simulator.

  • (void)tableView:(UITableView *)tableView commitEditingSytle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
    {
    //If the table view is asking to commit adelete command
    if (editingStyle == UITableViewCellEditingStyleDelete)
    {
    BNRItemStore *ps = [BNRItemStore sharedStore];
    NSArray *items = [ps allItems];
    BNRItem *p = [items objectAtIndex:[indexPath row]];
    [ps removeItem:p];

      //We also remove that row from the table view with an animation
      [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
    

    }
    }


#2

Did you put a breakpoint in there to see the code path?


#3

Found the problem. I misspelled commitEditingStyle: