...if another gesture is already in progress. Or at least that is how the problem appears to me. My app is Draw GIS (similar to Draw Maps in the App Store). It allows the user to freehand draw in the web map. To do so in my code, I add a gesture recognizer to capture drawing strokes. When a stroke begins, I have to disable mapView.interactionOptions. This used to work in earlier versions but somewhere along the way this stopped working. To get around the problem, I disable/enable the mapView's pan, pinch, and rotate gesture recognizers directly.
class MapView: AGSMapView {
...
func interaction(isEnabled: Bool) {
self.interactionOptions.isEnabled = isEnabled
guard let gestureRecognizers = gestureRecognizers else { return }
for gestureRecognizer in gestureRecognizers {
if let panGestureRecognizer = gestureRecognizer as? UIPanGestureRecognizer {
panGestureRecognizer.isEnabled = isEnabled
} else if let pinchGestureRecognizer = gestureRecognizer as? UIPinchGestureRecognizer {
pinchGestureRecognizer.isEnabled = isEnabled
} else if let rotationGestureRecognizer = gestureRecognizer as? UIRotationGestureRecognizer {
rotationGestureRecognizer.isEnabled = isEnabled
}
}
}
...
}
I hope this helps someone.
Thank you for posting the code that works for you. I'd be interested to learn more about what you are doing when the problem occurs. Internally, when the user sets the "self.interactionOptions.isEnabled" option to "false" (on the MapView) we are doing what you are doing, which is setting all the gestureRecognizers' isEnabled property to false.
According to the UIGestureRecognizer's interface doc for "isEnabled": "when changed to NO the gesture recognizer will be cancelled if it's currently recognizing a gesture", which *should* prevent the problem you are seeing.
If you could provide some more detail (or some sample code) that describes what's happening when you encounter the problem, I can see if there's anything we can do in the SDK.
Thanks again,
Mark