Dynamically changing the MKAnnotationView according to zoom level in MapKit?

290 Views Asked by At

Currently, I am calculating the zoom level each time mapViewDidChangeVisibleRegion is called. I would like to display one set of annotations at say, zoom level 5, and another set of annotations at zoom level 10.

Within the MKMapViewDelegate, there is a method to return an annotation view: func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView?, but this isn't called with the frequency I would need to swap out the view according to the zoom level.

So how can I make the annotation views display more dynamically in response to the change in zoom level / visible region?

0

There are 0 best solutions below