ios - Multiple Google Maps Navigation -
I think I'm a total idiot here, but I have total brain fart and XCode . To be able to navigate to a certain destination for the user, I have to open this code (below) Google Maps on which they click the button. On this page it's a fixtures list, which has an option next to navigation matches, am I right in saying that I do not need a new view controller because Google Maps should also pop up on the button press? In addition to this, I will need to create an If I think right, you can give directions to different matches Need to open Google Maps for First of all, you are right about whether or not you are a new view controller, because you are calling, you do not need to create a new view controller And this should open GoogleMaps to display the instructions given by your origin & amp; The destination coordinates are fine, if there is no possible direction then GoogleMaps will still open and tell you that no instructions were found. What you should do: Create an IBAction for handling buttons - (IBAction) button pressed: (ID) Sender {// to open your code here}; According to the sender you can find out what button was pressed. You have different ways to do this. A possible way is to add a tag to every button from the interface builder and later to read which tag was pressed to read the tag. Another option if you have a fixed amount button, for example 3 is to create IBOutlets for each button and compare the sender with 'IBolet'. Once you know that the sender will need to recover the coordinates associated with that button / match for the IBAction pressed button button. I hope it will be helpful! IBOutlet at the top to create by pressing the button
segue , obviously I will code this code to
- (zero ) Will not be able to view the view in the because I only want to show the button on the basis of press
- (zero) getDirections {CLLocationCoordinate2D start = {(startLatitude), (startLongitude)}; CLLocationCoordinate2D end = {(end latitude), (endlined)}; NSString * googleMapsURL String = [NSString stringWithFormat: @ "http://maps.google.com/?saddr=%1.6f,%1.6f&daddr=%1.6f,%1.6f", start.latitude, start.longitude , End.latitude, end.longitude]; [[UIApplication shared application] Opal: [NSL URL URL string: googleMapsURL String]]; }
< Code> [[UIApplication shared application] Open URL: [NSURL URLWithString: googleMapsURLString]];
Comments
Post a Comment