2

I am building an app that contains a MKMapView. The first time user goes over this view, it takes a while for it to load, and things such as animating pin drops also don't work well as a result of it. It takes a bit for the location to stabilize if i choose another location from the simulator options.

Is there any way to load MKMapView very fast? May be run in background or what?I am confused? What do you guys do to load Map Faster?

  • Did you try creating your map view controller and setting it's view's `alpha` to 0.0? I never tried to accomplish your task, but seems like that could work. You could even implement `MKMapViewDelegate` methods in your VC and notify the presenting view controller that your map is ready to be shown (say, by reacting to `- mapViewDidFinishLoadingMap:`). Hope this helps. – Daniil Korotin May 28 '15 at 08:50
  • so initially what will i be showing to the user? –  May 28 '15 at 11:08
  • Depends on your app. If the map is the only view — use the solution with a splash screen. – Daniil Korotin May 28 '15 at 11:26
  • i have a tableview showing on the initial screen..and mapview as the headerView in tableview.. –  May 28 '15 at 12:23
  • So maybe have it slide in after it's done loading? – Daniil Korotin May 28 '15 at 12:25

1 Answers1

1

put a splash screen on while it loads, and catch the event of the loading finishing is the delegate method mapViewDidFinishLoadingMap:

don't forget to set your ViewController (or other implementing object) as the delegate of the MKMapView object.

eiran
  • 1,378
  • 15
  • 16
  • 1
    actually it loads initially but takes time to show the current location with the animation? –  May 28 '15 at 11:07
  • you can use CLLocationManager to get the location, which have a delegate method didUpdateToLocation: see here: http://stackoverflow.com/questions/11513259/ios-cllocationmanager-in-a-separate-class – eiran Jun 01 '15 at 08:04
  • i just used that..but the time to get the current location is very slow...means mapview halts like for 3-4 sec to be stable –  Jun 04 '15 at 08:18
  • maybe you can take the location on your app delegate and save it.. so when you get to the map it'll be there already. – eiran Jun 04 '15 at 08:23