iPhone MKMapView 标注聚类 [英] iPhone MKMapView Annotation Clustering

查看:32
本文介绍了iPhone MKMapView 标注聚类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有很多图钉可以放在我的地图上,所以我认为将这些注释聚集在一起是个好主意.我不太确定如何在 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 文件夹复制到您的项目中,在您的笔尖中创建一个 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 标注聚类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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