开发者

iOS mapview issue/question

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?


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


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.


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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜