1

I'm creating business app which is using mapView for almost all functions. Now I'm considering, is it ok to use two mapView in one app?

To be more specific - I've created mapView and I've made some creations (like annotations etc.). Is it ok to create another mapView in modal view just to present some other function? Is some best practice to multiple using mapView? Should I consider using only one mapView?

Thanks for your help.

xxcat
  • 127
  • 7

1 Answers1

1

Yup, go for it .

Don't go crazy and use multiple when one would do. For example if you have a map in a controller and want to allow the user to toggle types of annotation on the map, then you should only be toggling the annotations. it would be silly here to have two map views, one with each type of annotation and switch the whole mapviews.

However if you have different controllers or parts of the app that need maps, map away.

George Green
  • 4,807
  • 5
  • 31
  • 45
  • How about memory? I noticed that new mapView needs 80mb. Of course this memory will be free while function will have closed, but still - before second map: 180mb memory, after present mapViewController: 260mb. – xxcat Mar 08 '17 at 12:45
  • MapKit will keep a cache of tiles and data as long as memory is available, you should definitely make sure to throw away any maps that are no longer being used, or are no longer on screen. Obviously if you add too many at a time you will get issues, try adding a couple and simulating a memory warning and it should start to clear it's cache. – George Green Mar 08 '17 at 12:48
  • To be honest, you save my day and makes me happy :) – xxcat Mar 08 '17 at 12:54