I've tried a number of things and to post code at this point would likely be confusing, so let me start with the concept.
I need to somehow combine the operations of long press and touch drag into a single operation, something like LongPressThenDragGestureRecognizer. I'm trying to accomplish this on an MKMapView, so I can't just disable user interaction the entire time, because I want the pan and zoom functionality of the map.
To complicate things a bit, the initial item (an MKOverlay object) that the user long-presses on to recognize interaction will need to be removed and replaced with a new drawn object. At that point, the the code doesn't care about the object anymore, only where the finger is at any given point (I will redraw the dragged object as they move).
This is the workflow:
- User is presented an overlay on the map
- User touches and holds on the item to let the app know they want to drag it
- The app replaces the overlay with a drawn object and disables the map so that it doesn't start panning (rather than dragging).
- User drags finger, and object redraws as they move.
- User lifts finger to complete the drag
- App replaces the drawn object with a new map overlay
- App enables user interaction on the map to allow pan/zoom/annotation selection, etc.
I've tried a number of things so far, with little success. The best results I have so far is listed below. This was done using a UILongPressGestureRecognizer on the MKMapView objects (checking intersection with overlay), and then overriding touchesBegan for map touch drag.
- Overlay is shown and user successfully performs a long-press gesture that gets recognized appropriately
- Map user interaction is disabled and overlay is replaced with drawn object
- User has to lift finger and touch down again to initiate the drag operation
- When user lifts finger, new overlay is drawn and map interaction is enabled again
I'm so close, I just don't know how to combine the gestures into one, so that the user doesn't have to lift his/her finger and touch down again to start the drag.
Any ideas are greatly appreciated.