I want to remove annotations , when开发者_如何学编程 the map scale is 50% or more. How can i do this?
Implement this method in your MKMapView's delegate:
- (void)mapView:(MKMapView *)mapView regionWillChangeAnimated:(BOOL)animated {
if (map scale is > 50%) {
[mapView removeAnnotations:[mapView annotations]];
}
}
Also, how are you calculating the zoom. What does 50% mean here?
MapKit
doesn't have the notion of zoom level. At any time, the map's viewport spans a particular MKCoordinateRegion
, so a 50% zoom in or zoom out is simply half the previous region.
Something I have found useful which makes it easier to manipulate the map view based on the notion of zoom levels, found here.
精彩评论