ios sdk MKMapView重叠针脚? [英] ios sdk MKMapView overlapping pins?

查看:146
本文介绍了ios sdk MKMapView重叠针脚?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有地图视图和许多引脚。

当缩小地图视图时,我将重叠的引脚分组为1(并在标签中显示其中的引脚总数)。

但该怎么办,如果地图视图最大放大,并且引脚仍然重叠?

I have map view and many pins on it.
When the map view is zoomed out, I group overlapping pins into 1 (and show in label total count of pins in it).
But what to do, if map view is max zoomed in, and pins are still overlapped?

我怎样才能转移它们他们互不重叠?

这样的事情:

How can I shift them while they do not overlap each other ?
Something like this:

还是有其他解决方案吗?

Or is there another solution?

推荐答案

在针对同一问题的略有不同的解决方案中, WWDC 2011#111 - 使用MapKit在地理上可视化信息视频(演示距离视频仅18分钟)说明了如何防止重叠注释的示例(包括一些漂亮的动画在放大和缩小时显示并隐藏更详细的注释。)

In a slightly different solution to the same problem, the demo in the WWDC 2011 #111 - Visualizing Information Geographically with MapKit video (the demo is a little more than 18 min into the video) illustrates an example of how you can prevent overlapping annotations (including some nice animation revealing and hiding more detailed annotations as you zoom in and out).

他们所做的是将mapview分解为特定大小的网格(我认为他们使用60px),如果它们太靠近,他们会选择一个用于该网格并隐藏其他网格。在缩小时,它们还可以优雅地隐藏注释(因此您可以看到隐藏的注释会飞入该组的可见注释中)。当您放大注释时,您会看到它从该网格的一个中心注释中飞出。

What they do is to break the mapview into a grid of a particular size (I think they use 60px), and if they are too close, they pick one for that grid and hide the others. They also do a graceful hiding of the annotations as you zoom out (so you can see the annotations that are being hidden fly into the visible annotation for that group). As you zoom in the annotations are unhidden, you see it fly out of the one central annotation for that grid.

这篇关于ios sdk MKMapView重叠针脚?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆