Iphone – Enabling Swipe-to-delete while showing reorder controls on UITableView

gestureiphoneuikituitableview

I am looking to allow reordering of UITableViewCells and deleting via swipe to delete, but not via the red delete circle.

- (void)loadView
{
    [super loadView];
    [table setEditing:YES animated:NO];
}

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (editingStyle == UITableViewCellEditingStyleDelete) {
        // Perform delete here
    }
}

- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath
{
    // Perform move here
}

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

- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath
{
    return YES;
}

Additionally, I've tried disabling the edit mode and calling -[UITableViewCell setShowsReorderControl:YES] with no luck.

Image
(source: booleanmagic.com)

Best Solution

I think you'll have to do some custom touch event interception.

In english: if finger moved, x distance, horizontally across cell, in that cell only, then show delete control.

Not sure how to turn off the circles to the left, but I do think it's a property like "shows reorder control"

Related Question