I'm trying to figure out how to debug the following scenario to understand why UITableView cells won't re-order.
In code:
The same view controller code and storyboard work correctly for reordering cells in another project.
I've searched stackoverflow and Google for a day and can't find any reference to what would cause a cell drag event to get canceled.
Any thoughts on how I could approach debugging this issue would be greatly appreciated!
I found the answer, and it had nothing to do with the UITableView code.
My code has a programmatically created root view controller that handles showing/hiding a sliding menu panel.
The viewDidLoad() of this view controller creates a panGestureRecognizer to track swipes for showing/hiding the sliding menu. This panGestureRecognizer was not passing through touches.
Adding this code fixed the problem:
panGestureRecognizer.cancelsTouchesInView = false
I experienced the same issue, and found the solution in my case was to add the various swipe & tap gestures on my tableview cells NOT to the cell itself, but to the contentView of the cell.
So, rather than this,
cell.addGestureRecognizer(myGesture)
the code becomes
cell.contentView.addGestureRecognizer(myGesture)
And that seems to work well, fixing the same sort of herky-jerky scrolling that the OP had. Perhaps somebody can benefit from this solution, if your issue is more like the one I was having than the one the OP had.
Longer discussion of the solution can be found here: Add a gestureRecognizer to a tableView cell
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With