检测MKMapView何时停止移动

时间:2015-09-04 02:14:49

标签: ios mkmapview uigesturerecognizer

每当用户移动我的MKMapView时,我会在地图上加载更多针脚。现在,我正在使用此代码来检测它们何时拖动它:

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
    return YES;
}

- (void)didDragMap:(UIGestureRecognizer*)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];
    }
}

但是,这仅检测用户何时停止拖动。用户可以“甩掉”地图,地图在完成“拖动”之后仍然可以移动。当地图停止移动时,我能找到一种方法吗?感谢

1 个答案:

答案 0 :(得分:1)

试试这个代表:

mapView:regionDidChangeAnimated: