0

I try to get the selected rows of an UITableView after editing mode ends.

- (void)tableView:(UITableView *)tableView didEndEditingRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSLog(@"did end editing");
    NSArray *selectedRows = [tableView indexPathsForSelectedRows];
    NSLog(@"%i", selectedRows.count);
}

This unfortunately doesn't work. This method never gets called, when I'm ending editing.

In fact I want the user to be able to select some rows and pass the respective data into a mail.

How do get these cells?! I hope you can help me!

Greetings, Julian

Julian F. Weinert
  • 7,474
  • 7
  • 59
  • 107

1 Answers1

0

I don't think editing is the thing you want to be looking for.

Editing applies to just one cell at a time. (via docs)

You probably need to implement your own edit mode and handle keeping track of which cells a user selects to perform an edit on. Then when they say "commit edit" (or w/e language you are using) then perform that edit on those cells.

This might help:

Edit & delete multiple rows in UITableView simultaneously

Community
  • 1
  • 1
RyanJM
  • 7,028
  • 8
  • 60
  • 90
  • 1
    I just figured out some way. I'm putting the cells into an array `if(tableView.editing){[array addObject:cell];}` when selecting and delete them when deselecting. I don't know if this is a very charming way... But it works for me :) Thanks for answer, though – Julian F. Weinert Apr 03 '12 at 04:45
  • I think that makes a lot of sense. Glad you were able to figure out a way. – RyanJM Apr 03 '12 at 04:48