Reputation: 992
I've got a UITableView
which I've wired up to be editable.
Tapping and holding causes the "displace" animation to appear (the row being drawn "above" the rest of the table). So far, so good.
But, moving the row any more than about 10 pixels causes the cell to return to its original position, and I can never move any row to any other position.
A breakpoint reveals that -tableView:moveRowAtIndexPath:toIndexPath:
is definitely being called, albeit with the same index path as the source and destination rows.
Can any psychic debuggers shed some light on this?
EDIT Some more relevant info:
There's a UILongPressGestureRecognizer
on the UITableViewCell
, but I've made it skip its usual behaviour while the table view it's contained in is in editing mode.
I suspect this might be something to do with it, as UITableView
reordering is also triggered by a long press.
Upvotes: 0
Views: 412
Reputation: 331
Probably I've came too late with a solution for you, but it might be helpful to others who encounter the same behavior. The problem you're having is caused by the UILongPressGestureRecognizer
interfering with the long press on the cell's reorder control. You can avoid this behavior by adding UILongPressGestureRecognizer
on the cell.contentView
instead of adding it to the cell, since the reorder control it's not in the cell's contentView.
Upvotes: 2
Reputation: 4131
When you move the tableview's cell, do you also move their data source?
for example,
NSString* stringToBeMoved = [myArray objectAtIndex:[sourceIndexPath row]];
[stringToBeMoved retain];
[myArray removeObjectAtIndex:[sourceIndexPath row]];
[myArray insertObject:stringToBeMoved atIndex:[destinationIndexPath row]];
[stringToBeMoved release];
Upvotes: 0