2

Whenever the user moves my MKMapView, I load more pins on to the map. Right now, I am using this code to detect when they drag it:

- (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];
    }
}

However, this only detects when a user stopped dragging. A user can "fling" the map and the map can still be moving AFTER they finish "dragging". Is there a way I can find when the map stops moving? Thanks

user1282637
  • 1,827
  • 5
  • 27
  • 56

1 Answers1

2

Try this delegate:

mapView:regionDidChangeAnimated:

francesco.venica
  • 1,703
  • 2
  • 19
  • 54