views:

234

answers:

2

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?

+2  A: 

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.

Steve Madsen
if you arent reusing the annotations and you hve thousands then it could cause a memory issue..
Daniel
Well, I might eventually have over a thousand...
Nic Hubbard
yea so reuse the annotations :)
Daniel
which the mapkit does for you alraedy, you just have to declare a reusableidentifier when creation the annotation type
Daniel
MapKit reuses annotation views, not the annotations themselves. An annotation should just be data. If memory is a real problem because an annotation is that big, I'd try splitting it and lazy-loading everything except the bare minimum data (coordinate and an ID).
Steve Madsen