Setting MKMapViewLocation with Buttons

Discussion in 'iOS Programming' started by RobbS, Apr 21, 2011.

  1. macrumors newbie

    Joined:
    Apr 21, 2011
    #1
    Pretty new to app development, still in the learning process.

    In my app, I have three buttons for three different location. I want to set each button to take you to a different location, how would I achieve this?

    I read through the documentation here, but still don't have an answer. Can someone help out?
     
  2. macrumors demi-god

    Joined:
    Jul 7, 2007
    #2
    Do you have the basics setup? By that I mean, does your app currently show a specified location? There's a bunch of tutorials on using the MapKit.

    You need to setup a CLLocationCoordinate2D property and set it to the specific location for each button. Then you can create a region that contains this location and pass that to your mapView.

    Look here: http://blog.objectgraph.com/index.php/2009/04/03/iphone-sdk-30-playing-with-map-kit-part-2/


    [mapView setRegion:region animated:TRUE];
    [mapView regionThatFits:region];
     

Share This Page