开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜