Back to: All Forums  Using Map Kit  Reset Map
21 Sep 2010, 18:37
Current_pragsmall

Matthew Gallagher (3 posts)

I am trying to find a way to reset the map to the state when the app starts. I would like to add a button in the navigation bar to reset/reload/recenter the map. For example, after someone scrolls around and plays a bit with the map I would like them to be able to click the button and the map reverts back to its initial state from the viewDidLoad.

I have not been able to find anything on any board on how to manage this. I imagine it will work with the setRegion, but not sure what to do in order to accomplish this task. Any help would be appreciated.

17 Oct 2010, 05:04
Biopic_100x100_pragsmall

Bill Dudney (917 posts)

Hi Matthew,

Sorry to be so late getting back to you!

You are on the right track, you need to set the region when the user taps the button. But first you need to store the region, in your viewDidLoad method just grab the region from the mapView and store it in an instance variable.

Then when the user taps the button to return to the original location you can set the map’s region to your instance variable’s value.

19 Oct 2010, 14:10
Current_pragsmall

Matthew Gallagher (3 posts)

Cool, thanks Bill. Will give it a try.

  You must be logged in to comment