简体   繁体   English

ios SDK MKMapView重叠引脚?

[英]ios sdk MKMapView overlapping pins?

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). 缩小地图视图时,我将重叠的引脚归为1(并在其中显示标签的引脚总数)。
But what to do, if map view is max zoomed in, and pins are still overlapped? 但是,如果最大放大了地图视图,并且引脚仍然重叠,该怎么办?

http://s24.postimg.org/7g3l8resl/image.jpg

How can I shift them while they do not overlap each other ? 当它们彼此不重叠时,如何移动它们?
Something like this: 像这样:

http://s24.postimg.org/njp901v39/map1.jpg

Or is there another solution? 还是有其他解决方案?

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). 在针对同一问题的解决方案稍有不同的情况下, WWDC 2011#111中的演示-使用MapKit视频在地理上可视化信息 (该演示距离视频仅18分钟多一点),展示了如何防止注释重叠的示例(包括一些不错的动画,可以在放大和缩小时显示和隐藏更详细的注释)。

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. 他们要做的是将地图视图分成一个特定大小的网格(我认为他们使用60像素),如果它们太近,他们会为该网格选择一个,然后隐藏其他网格。 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. 放大未隐藏的注释时,您会看到它从该网格的一个中央注释中飞出。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM