MKMapView memory usage is very large

So I have a UIScrollView with a UIPageControl that has a bunch of MKMapViews (basically 15 different maps). The application is really sluggish as soon as this view loads, and after a few minutes of use I get a memory warning. I looked at him in "Tools", and an insanely high chunk of memory appeared on the cards. Even up to ~ 200 mb sometimes. One thing I can think of is reusing mapViews. But because of how the views are structured, the coding complexity is increasing. Any suggestions on how I can improve performance?

This is how my application is structured:

I have a view controller that has a UIScrollView, which I use for horizontal scrolling. In scrollView, I read subviews from an array of view controllers that contains mkmapview.

Hope that made sense! I used the Apple pageControl example application as a guide when coding, so the design is about the same.

Thanks in advance!

EDIT: So, I tried to add one instance of mapView and change the coordinates when scrolling. It still takes up a decent amount of memory.

+2
memory-management ios xcode uiscrollview mkmapview
source share
1 answer

To scroll an arbitrary number of pages in the scroll view, you need only two types of content, not 15. This is because at any given time there will be no more than two types of content. You can -scrollViewDidScroll: your content in the UIScrollView delegate -scrollViewDidScroll: method.

0
source share

All Articles