我有很多图钉要放在我的地图上,所以我认为将这些注释聚集在一起是个好主意.我不太确定如何在 iPhone 上实现这一点,我可以使用谷歌地图和一些 javascript 示例来解决问题.但是 iPhone 使用它的 mkmapview,我不知道如何在其中聚集注释.
I've got quite a lot of pins to put on my map so I think it would be a nice idea to cluster those annotations. I'm not really sure how to achieve this on iPhone, I was able to work something out with google maps and some javascript examples. But iPhone uses its mkmapview and I have no idea how to cluster annotations in there.
您有什么好的想法或框架吗?谢谢.
Any ideas or frameworks that you know and are good? Thanks.
由于这是一个非常常见的问题,我需要一个解决方案,所以我编写了一个支持集群的自定义子类 MKMapView.然后我把它开源了!你可以在这里得到它:https://github.com/yinkou/OCMapView.
Since this is a very common problem and i needed a solution i have wrote a custom subclass of MKMapView which supports clustering. Then i made it available open source! You can get it here: https://github.com/yinkou/OCMapView.
它管理注释的集群,您可以自己处理它们的视图.您不需要做任何事情,只需将 OCMapView
文件夹复制到您的项目中,在您的 nib 中创建一个 MKMapView
并将其类设置为 OCMapView
.(或者像常规的 MKMapView
一样在代码中创建和委托它)
It manages the clustering of the annotations and you can handle their views by yourself.
You don't have to do anything but to copy the OCMapView
folder to your project, create a MKMapView
in your nib and set its class to OCMapView
. (Or create and delegate it in code like a regular MKMapView
)
这篇关于iPhone MKMapView 注解聚类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!