hgbnerd hgbnerd - 1 month ago 8
iOS Question

determine if MKMapView was dragged/moved

Is there a way to determine if a MKMapView was dragged around?

I want to get the center location every time a user drags the map using

CLLocationCoordinate2D centre = [locationMap centerCoordinate];
but I'd need a delegate method or something that fires as soon as the user navigates around with the map.

Thanks in advance

Answer

Look at the MKMapViewDelegate reference.

Specifically, these methods may be useful:

- (void)mapView:(MKMapView *)mapView regionWillChangeAnimated:(BOOL)animated
- (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated

Make sure your map view's delegate property is set so those methods get called.