0
votes

I have a MKPinAnnotationView that is always in the center of the map. When panning and zooming the pin gives me the center coordinates (lat/long) of the map.

Currently when you zoom in, it just zooms into wherever your directing the map to zoom into.

I'd really like to lock the zoom onto the pin.

Any ideas on how I'd achieve this?

1
You might be looking for something like this: stackoverflow.com/questions/11830516/….user467105

1 Answers

0
votes

Assuming by MKPinAnnotation you mean MKPinAnnotationView, you can access the annotation's coordinate and use that to create a region and subsequently set the region of the mapView to that region centered on the coordinate:

MKCoordinateRegion region = MKCoordinateRegionMake(pin.annotation.coordinate, MKCoordinateSpanMake(.05, .05));
[self.mapView setRegion:region animated:YES];