Stefan Kendall
Stefan Kendall

Reputation: 67892

uitableview re-order won't work, source always equal to destination

I have a tableview that won't reorder. It looks like moveRowAtIndexPath is never called with a sourceIndexPath that is different from the destinationIndexPath. When I pull a row, it bounces back to its starting location as if the row didn't support movement.

I tried implementing all the "canMove/canEdit/propose" methods to return YES, but I observe the same behavior. What's going on?

- (void) tableView:(UITableView *)tableView
moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath
       toIndexPath:(NSIndexPath *)destinationIndexPath {

    NSLog(@"%d -> %d", [sourceIndexPath row], [destinationIndexPath row]);
    if ([sourceIndexPath row] == [destinationIndexPath row]) {
        return;
    }

    MyDomain *domain = [self getObject];
    [domain.stuff exchangeObjectAtIndex:(NSUInteger) [sourceIndexPath row] withObjectAtIndex:(NSUInteger) [destinationIndexPath row]];
}

Upvotes: 1

Views: 420

Answers (1)

Stefan Kendall
Stefan Kendall

Reputation: 67892

I'm using IIViewDeckController, which cancels panning in views.

When setting up the ViewDeckController, do this: self.panningCancelsTouchesInView = NO;

Upvotes: 2

Related Questions