当地图比例为 50% 或更大时,我想删除注释。我该怎么做?

发布于 2024-10-09 16:26:44 字数 36 浏览 0 评论 0原文

当地图比例为 50% 或更大时,我想删除注释。我该怎么做?

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

于我来说 2024-10-16 16:26:44

在 MKMapView 的委托中实现此方法:

- (void)mapView:(MKMapView *)mapView regionWillChangeAnimated:(BOOL)animated {
    if (map scale is > 50%) {
        [mapView removeAnnotations:[mapView annotations]];
    }
}

另外,您如何计算缩放。这里的50%是什么意思?

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?

国际总奸 2024-10-16 16:26:44

MapKit 没有缩放级别的概念。在任何时候,地图的视口都会跨越特定的 MKCooperativeRegion,因此 50% 的放大或缩小只是之前区域的一半。

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.

梦旅人picnic 2024-10-16 16:26:44

我发现一些有用的东西可以更轻松地基于缩放级别的概念来操作地图视图,发现 此处

Something I have found useful which makes it easier to manipulate the map view based on the notion of zoom levels, found here.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文