double tap and zoom on google map ios
-
28-06-2021 - |
Question
There are two delegate methods that telling map region is changed:
- (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated
- (void)mapView:(MKMapView *)mapView regionWillChangeAnimated:(BOOL)animated
My question is: Is there a way to detect the map region is changed from double tap or zooming?
Solution
You can use a gesture recognizer to detect the double tap:
UITapGestureRecognizer *recognizer = [[UITapGestureRecognizer alloc]
initWithTarget:self action:@selector(handleDoubleTap:)];
recognizer.numberOfTapsRequired = 2;
[self addGestureRecognizer:recognizer];
and do the same for the pinch zoom, with a UIPinchGestureRecognizer
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow