Nic Hubbard Nic Hubbard - 8 months ago 84
iOS Question

iOS - MKMapView show annotation only a certain zoom level

I have a MKMapView with some custom annotations that don't look that great when the map is zoom far out.

Is it possible to only show/add them when the map is at a certain zoom level?


You can get the map zoom level via

[map region];

property of the MKMapView. also you get the notifications for region changing events by implementing the MKMapViewDelegate method and setting the delegate

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

here you can check what your current zoom level is. I don't recommend removing or adding all the annotations while zooming / panning since that could really effect the app performance. I haven't really tried setting alpha to 0.0 or hidden property on MKAnnotationView, but that could be your best bet.