問題描述
我有很多圖釘要放在我的地圖上,所以我認為將這些注釋聚集在一起是個好主意.我不太確定如何在 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模板網!