iOS 地图视图问题

发布于 2024-11-17 21:31:35 字数 448 浏览 4 评论 0原文

我有一个正在为 iOS 开发的应用程序,该应用程序执行以下

加载和设置注释并启动核心定位和缩放到位置。

地图上有很多注释,从数据加载并不需要很长时间,但将它们实际渲染到地图上需要一段时间..所以用户界面有点停滞,然后最后获取核心位置并缩放到它。

虽然这是功能性的,但它不太理想的用户体验。我可以颠倒顺序,而不是先进行核心定位缩放,然后调用添加注释,但这也会导致 UI 暂停,因为注释是在UI 线程,更不用说 corelocation 也可能需要一些时间才能首先获取其位置。

所以,我想我要问的问题是处理这个问题的最佳方法是什么?有什么我不知道的方法可以在不占用 UI 的情况下将注释渲染到地图上吗?我猜想,在这种情况发生时,我可以在地图上显示某种闪屏,但这似乎是一种逃避,而且我个人讨厌闪屏。

也许最好的方法是在地图上显示“忙碌/工作”微调器,直到完成?

通常被认为是最佳实践的是什么?

I have an App I am developing for iOS, and the app does the following

Load and set annotations and launch corelocation and zoom to location.

There are a lot of annotations on the map, the loading from data doesn't take long, but the actual rendering of them them to the map takes a while.. so the user interface sort of stalls for a little bit, and then finally gets the corelocation and zooms to it.

While this is functional, it is less than ideal user experience.. I could invert the order, than do the corelocation zoom first and then call the add annotations, but this would cause a pause to the UI as well since annotations are added in the UI thread, and not to mention that corelocation could take a little time to get its location first too.

So, the question I guess I am asking is what is the best way to handle this? Is there some way I am unaware of to have the annotations render to the map without tying up the UI? I could show some sort of Splash Screen I guess over the map while this is going on, but that seems a cop out, and I personally hate splash screens.

Maybe the best way to do this is to show the BUSY/WORKING spinner over the map until its completed?

What is generally considered best practice?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

自我难过 2024-11-24 21:31:35

您可以使用 OCMapView 来聚集所有注释。正如已经提到的,地图可以处理一堆注释,但性能会随着绘制视图的数量而下降,并且 MKannotationView 不会产生任何影响。
OCmapView 聚集所有注释并将它们合并在单个注释视图中显示。尝试一下,它是免费的。
https://github.com/yinkou/OCMapView

You could use OCMapView to cluster all annotations. As already mentioned, the map can handle a bunch of annotations but the performance goes down with the number of drawn views and MKannotationViews don't make a difference.
OCmapView clusters all annotations and displays them merged in a single annotationView. try it out, it's free.
https://github.com/yinkou/OCMapView

美人骨 2024-11-24 21:31:35

我最终只是做了与 android 版本相同的事情,虽然 iphone 可以比 droid 更好地处理大量注释,但延迟加载方法对于两个平台来说无疑是更好的整体体验。

谢谢你们的帮助。

I wound up simply doing the same thing I did with the android version, while iphone can handle the larger number of annotations far better than droid, the lazy loading approach certainly is a better overall experience for both platforms.

Thanks for the help guys.

煞人兵器 2024-11-24 21:31:35

我认为最好的解决方案就是不向地图添加“大量”注释。 MKMapView 有很多事情要做,不需要大量的注释来让它陷入困境。有许多创造性的方法可以减少注释的数量。

如果您有许多紧密组合在一起的注释,请考虑将它们聚合到单个注释中,然后当用户达到令人满意的接近缩放级别时将其拆分为单独的注释。

另一个考虑因素是默认用户使用更严格的缩放级别,并且仅添加当前在屏幕上处于该缩放级别和位置的注释。

这些选项中的任何一个听起来可行还是让您考虑另一种创造性的方法来帮助您的情况?

I think your best solution would be to simply not add "a lot" of annotations to the map. MKMapView has a lot going on and it doesn't take a ton of annotations to bog it down. There are a number of creative ways that you can go about reducing the number of annotations.

If you have a lot of annotations that are grouped tightly together, consider aggregating them into a single annotation which then split apart into separate annotations when the user reaches a satisfactorily close zoom level.

Another consideration would be to default the user to a tighter zoom level and only add annotations that are currently on screen at that zoom level and position.

Do either of those options sound viable or get you thinking about another creative way to help your situation?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文