views:

20

answers:

2

from the docs:

the reordering control temporarily replaces any accessory view.

So when I do implement tableView:moveRowAtIndexPath:toIndexPath: in the data source, I would automatically get those reordering controls, right? But when they replace the accessory view (which may be the deletion control, right), then the user can only reorder. So ... can I do both?

+1  A: 

The accessory controls are the disclosure buttons on the right of the cell. The deletion control is on the left of the cell. Deletion control and reorder control can coexist.

KennyTM
+1  A: 

IIRC, you can do both. I think the delete button (from swipe left) is overlaid on the row and isn't an accessory view.

Implement:

- (UITableViewCellEditingStyle) tableView:(UITableView *) iTableView editingStyleForRowAtIndexPath:(NSIndexPath *) iIndexPath {
    return UITableViewCellEditingStyleDelete;
}

and

- (void) tableView:(UITableView *) iTableView commitEditingStyle:(UITableViewCellEditingStyle) iEditingStyle forRowAtIndexPath:(NSIndexPath *) iIndexPath {
    if ( iEditingStyle == UITableViewCellEditingStyleDelete ) {
        //delete row & data
    }
}

This will let you swipe to delete. For reordering controls I'm not sure if it's enough to just implement tableView:moveRowAtIndexPath:toIndexPath: , you might also need to set the editing property of the tableview to YES.

Sorry I'm not more specific, it's been a while since I've done major tableview tweaking. Test a few things out and see what works. :)

par
Thanks, going to check that out.
dontWatchMyProfile