开发者

I want to remove annotations , when the map scale is 50% or more. How can i do this?

开发者 https://www.devze.com 2023-02-01 10:36 出处:网络
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:

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消