Denis Kharitonov Denis Kharitonov - 1 year ago 77
iOS Question

Can't reorder rows in UITableView

I have encountered an issue when trying to reorder rows in

I have the function
triggered, but
is equal to
(i.e. source == destination).
I saw the same issue here: uitableview re-order won't work, source always equal to destination
But the solution was - to use different library. That is not a variant for me.

- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
//fromIndexPath is equal to toIndexPath, so nothing is exchaned
[self.table_data exchangeObjectAtIndex:fromIndexPath.row withObjectAtIndex:toIndexPath.row];

My table is in editable mode, I have
. My it does not help.
How come? What am I doing wrong?

Answer Source

The problem was in custom pan gesture recognizer. It somehow was in conflict with rows drag-drop behavior

Setting myGestureRecognizer.cancelsTouchesInView = NO; fixed the issue

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download