Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

straber

macrumors member
Original poster
Jul 3, 2012
60
0
I have enabled dragging from a table cell by attaching a pan gesture recognizer to the label in each table cell. This works perfectly for letting users drag an item from the tableview over onto the main view, which is what I want, however this also causes the tableview to not scroll because the label is handling the drag motion instead of the tableview. Is there a way I can keep the dragging for horizontal movements, but have the tableview handle scrolling for vertical drags?
 
Last edited:
You can add a single Gesture to the tableView itself to detect the sideways swipes, allowing the vertical swipes to be still handled by the tableView.

The trick is you then need then work out with the Tableview which cell is under the swipe. this handy blog article goes in to full detail.

http://blog.blackwhale.at/?p=795

I had it working with gesture recognizers in the cells before I found this, the tricky bit was making sure your gesture recognizer is passing through gestures event it doesn't recognize to the views below it. But if you can get the above to work for you it seems to work more reliably and smoothly when testing on the device.
 
Thank you, MattInOz. This worked nearly perfectly. The only thing I had to change was that I had to add a gesture to the textLabel in each table cell, adding just one to the table worked, but it would only allow me to drag around inside the table, once I hit the border of the table, the text would stop there as my finger continued dragging. Other than that, works like a charm!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.