Do MKMapView just zoom in on centerCoordinate?

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

Nowadays, when you zoom in, it just scales wherever you map the map.

I would really like to lock the zoom on the pin.

Any ideas on how I could achieve this?

0
source share
1 answer

Assuming MKPinAnnotation you mean MKPinAnnotationView, you can access the coordinate of the annotation and use it to create a region and then set the mapView region to this region centered on the coordinate:

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

Source: https://habr.com/ru/post/891538/


All Articles