This memory will increase to dozens of megabytes, which is normal.
Mapview uses tiledLayer (tiled Layer). For rendering speed, map tiles are cached in memory. When zooming, map tiles will be cached at different levels.
I guess when memory is tight, MKMapView will clear the cache by itself, so I don’t think you need to worry about this issue.
PS:1 This is the solution given by stackoverflow, I really don’t understand why.
This memory will increase to dozens of megabytes, which is normal.
Mapview uses tiledLayer (tiled Layer). For rendering speed, map tiles are cached in memory.
When zooming, map tiles will be cached at different levels.
I guess when memory is tight, MKMapView will clear the cache by itself, so I don’t think you need to worry about this issue.
PS:1 This is the solution given by stackoverflow, I really don’t understand why.
PS:
Personally I prefer
Release the map in the viewDidDisappear method, and then reinitialize it when you need it.
Solution found:
In the regionDidChange method of mapview, it is judged that if map.zoomLevel is less than a certain range, alternate mapType
This can effectively reduce the memory peak.
Because when the map is reduced to a certain range, details such as shops on it should have been cleared to save memory.
In the regionDidChange method of mapview, it is judged that if map.zoomLevel is less than a certain range, alternate mapType
This can effectively reduce the memory peak.
How is it done? ? ? ? ? Does mapView have the zoomLevel attribute? ? ?