0

I'm trying to delete a row using Xcode 4.2 and a storyboard. The Table is nested in a UINavigationController nested in a UITabBarController.

My UITableViewDelegate class implements the following code:

- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCellEditingStyle result = UITableViewCellEditingStyleNone;

    if ([tableView isEqual:self.tableView]==YES) {
        result = UITableViewCellEditingStyleDelete;
        NSLog(@"hi");
    }

    return result;
}

and when I swipe a row, I see the "hi" message in the log, but the row never receives a "Delete" button. Looking at sources like http://www.raywenderlich.com/5138/beginning-storyboards-in-ios-5-part-1, my

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
    NSLog(@"hi2");
} 

method is never called.

Thanks!

Nekto
  • 17,837
  • 1
  • 55
  • 65
Timothy Newton
  • 135
  • 1
  • 7

1 Answers1

0

Check if method - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath returns YES for appropriate index paths.

Nekto
  • 17,837
  • 1
  • 55
  • 65