Mapkit:仅在当前视图中显示注释
我不想加载数组中的所有注释,而是只想加载用户当前可以看到的注释(根据他们在地图上放大的程度)。因此,如果用户平移到有注释的位置,这些注释就会被添加,如果用户平移到有注释的地方,这些注释就会被删除。我想这对记忆有帮助。
有谁知道如何做这样的事情?而且,这值得或者需要吗?
Instead of loading all annotations that are in my array, I would only like to load the annotations that the user could currently see cased on how far they are zoomed in on the map. So, if the user pans to a place where there are annotations, those would be added, and if they pan away, those would be removed. I assume this would help with memory.
Does anyone know how to do something like this? And, is it worth it, or needed?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不需要。 MapKit 负责优化注释视图的显示和分配。您应该加载所有注释并让框架完成其工作,就像文档建议的那样。
注释本身应该非常小,并且不会对内存使用产生重大影响。
It is not needed. MapKit takes care of optimizing the display and allocation of annotation views. You should load all your annotations and let the framework do its job, just as the documentation advises.
The annotations themselves should be quite small, and should not have a significant hit on memory use.