Once I have used AGSMapView toMapPoint to create the mapPoint object within my custom, transparent UIView's UITapGestureRecognizer event handler, what selector on the mapView can I call with my mapPoint parameter so that the AGSMapView's didClickAtPoint event will be triggered?
There seems no programmatic way to trigger the AGSMapViewTouchDelegate's events.
Some clarification ...
I need to lock down the map mode so users don't switch from Navigation, Compass, or Auto-Center mode to manual pan (AGSLocation/displayAutoPanModeOff) with accidental swipes of the screen. This has generated user complaints from fans of navigation mode. I'm trying to implement what I'm calling "locked" navigation, compass, and auto-center modes, each making the map view ignore swipes.
Disabling user interaction is no solution because they need taps to identify and edit features, and they want the tap-hold for accessing the magnifier.
The context for my question above is I'm trying out a transparent UIView above the map view such as outlined here: how to disable pan and zoom and use drag, only passing the taps and the tap-holds through to the map. I'm not seeing a way though to call the map view programmatically from my UIView's gesture handlers to make it think it's been tapped.
Since that hasn't worked, I'm also looking into overriding the map view's gesture handlers to ignore swipes.
Thanks
I came up with a solution that's working well, but will require my review each time the iOS SDK is updated to a new version: remove any array elements from AGSMapView.gestureRecognizers that handle the user interaction I want to restrict. At the current release, there are seven gestureRecognizers, and the three I keep are the UILongPressGestureRecognizer (I have enabled the magnifier) and the two UITapGestureRecognizers. This lets the map support identify, editing, and the magnifier without letting the users accidentally pan the map out of the navigation, auto-center, or compass modes. I save the others in a module level array in my view controller, adding them back to the AGSMapView's gestureRecognizers when the user picks a "non-locked" map mode from the UI picker I made.
The ones I set aside are UIPanGestureRecognizer, AGSMultiTapGestureRecognizer, UIPinchGestureRecognizer, and UIRotationGestureRecognizer. This routine below is what I call to "lock" the current map mode, and I have another written in the reverse logic to "unlock" the map mode.
- (void) removePanGesturesFromMap {
NSMutableArray * mutableGestureRecognizers = [[NSMutableArray alloc] initWithArray:self.mapView.gestureRecognizers];
NSMutableArray *recognizersToRemove = [[NSMutableArray alloc] init];
for (UIGestureRecognizer * gestureRecognizer in self.mapView.gestureRecognizers) {
if (![gestureRecognizer isKindOfClass:[UILongPressGestureRecognizer class]]
&& ![gestureRecognizer isKindOfClass:[UITapGestureRecognizer class]] ) {
[recognizersToRemove addObject:gestureRecognizer];
}
}
if (recognizersToRemove.count > 0) {
[mutableGestureRecognizers removeObjectsInArray:(NSArray*) recognizersToRemove];
self.preservedMapPanGestureHandlers = recognizersToRemove;
self.mapView.gestureRecognizers = (NSArray*)mutableGestureRecognizers;
}
}
Can we have this as a feature to AGSMapView? MapKit framework has scrollEnabled property to do this. A similar property can be added to AGSMapView so that scroll and pan can be disabled and user can still tap on Graphics on the screen. I am sure this would be a common use case when people are doing free hand drawing/geo fence on maps.
Regards,
Akhil