I am trying to detect when user starts and stops dragging on mapview with this following code:
- (void)viewDidLoad {
UIPanGestureRecognizer* panRec = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(didDragMap:)];
[panRec setDelegate:self];
[_mapView addGestureRecognizer:panRec];
}
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
return YES;
}
- (void)didDragMap:(UIGestureRecognizer*)gestureRecognizer {
if (gestureRecognizer.state == UIGestureRecognizerStateEnded){
NSLog(@"drag ended");
}
}
However, the map seem doesn't move at all while the UIGestureRecognizer gives me what I want.
What could be wrong?
Well, I only need to add this
Not sure is it Baidu Map bug or not since MKMapView works fine without that option.