每当用户移动我的 MKMapView 时,我都会在 map 上加载更多图钉。现在,我正在使用这段代码来检测他们何时拖动它:
- (BOOL)gestureRecognizerUIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizerUIGestureRecognizer *)otherGestureRecognizer {
return YES;
}
- (void)didDragMapUIGestureRecognizer*)gestureRecognizer {
if (gestureRecognizer.state == UIGestureRecognizerStateEnded){
CLLocationCoordinate2D topLeft, bottomRight;
topLeft = [self.mapView convertPoint:CGPointMake(0, 0) toCoordinateFromView:self.mapView];
CGPoint pointBottomRight = CGPointMake(self.mapView.frame.size.width, self.mapView.frame.size.height);
bottomRight = [self.mapView convertPoint:pointBottomRight toCoordinateFromView:self.mapView];
[self loadMorePlaces:topLeft bottomRight:bottomRight];
}
}
但是,这只检测用户何时停止拖动。用户可以“ throw ” map ,并且在他们完成“拖动”后 map 仍然可以移动。有什么方法可以找到 map 停止移动的时间吗?谢谢
Best Answer-推荐答案 strong>
试试这个委托(delegate):
mapView:regionDidChangeAnimated:
关于ios - 检测 MKMapView 何时停止移动,我们在Stack Overflow上找到一个类似的问题:
https://stackoverflow.com/questions/32389078/
|