Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mapkit: Only show annotations in current view

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?

like image 512
Nic Hubbard Avatar asked Sep 14 '26 09:09

Nic Hubbard


1 Answers

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.

like image 122
Steve Madsen Avatar answered Sep 16 '26 22:09

Steve Madsen