In my app I've got a UINavigationController
.
In some of the pages I got a MKMapView
as the back view (allows changes to map view the overlay UIView
UI, so I can't make it as a image).
In some combinations, It's possible to have 3 or so MKMapView
alloc'd.
The problem is that each MKMapView
takes nearly 60MB, so the memory jumps up to 180+ MB only from the maps. not to mention if the user opens more ViewControllers with map, he'll get a OutOfMemoryException
.
All the maps have the same content, I tried moving a map from ViewController
to another, but according to another post in StackOverflow, moving UIView
from ViewController
to another is against MVC, not to mention it removes it from the caller ViewController
.
Basically since all the maps contains the same content, and I want them the contain all the annotations it'd be best to just move the map but I had hard time with that.
I've got a solution out of the box which is to remove the MKMapView
from its superView and on viewWillAppear
realloc it, but this doesn't seem like the best idea.