iPhone MapKit - 同时删除多个图钉
在我的应用程序中,我添加了很多引脚,并且在 viewForAnnotaion
中,我在 MKPinAnnotaionView
上设置了 animatesDrop=TRUE
。问题是,当有 200 多个引脚时,一个接一个地掉落需要很长时间。我见过一次性删除所有图钉的应用程序,我想知道如何做到这一点。
如果我不清楚,请告诉我。
谢谢!
In my app i'm adding alot of pins and in viewForAnnotaion
I set animatesDrop=TRUE
on my MKPinAnnotaionView
. The problem is that when having 200+ pins dropping one by one takes a long time. I have seen Apps that drops all pins at once and wonder how to do that.
Let me know if i'm not clear.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你所做的并没有错 - 但你可能想尝试在辅助线程上创建这些引脚(你的应用程序会更快)。
此外,您可能有一些计算成本较高的操作,您可能希望将其移至委托方法之外(即
viewForAnnotation
)。最后,您可以尝试靠近较小的区域,以便您的地图显示更少的图钉。
What you are doing is not wrong - but you might want to try creating those pins on a secondary thread (your app will be snappier).
Also, you might have operations that are computationally expensive that you might want to move outside the delegate method (i.e.
viewForAnnotation
).Finally, you can try closing in on a smaller area, so that your map displays less pins.
我认为这是通过检测引脚最接近来以编程方式完成的。
您可以根据地图缩放构建不同的引脚列表,以仅显示屏幕上 x 像素间隔的引脚。
I think it is done programmatically by detecting that pins are closest.
You could build differents list of pins depending on the map zoom to display only pins that are separates of x pixels on the screen.