Show Directions on Google Map in the iPhone.


/ Published in: Objective C
Save to your folder(s)

Here is a peace of code from one of my project to show you how you to show directions on the Google Map application.


Copy this code and paste it in your HTML
  1. - (void)showDirections {
  2. if ([self.address length] == 0) return;
  3. //We create our link to the appDelegate
  4. ClubPlanetControllerAppDelegate * appDelegate = (ClubPlanetControllerAppDelegate *)[UIApplication sharedApplication].delegate;
  5.  
  6.  
  7. NSURL *myURL = [NSURL URLWithString:[NSString stringWithFormat:@"http://maps.google.com/maps?daddr==%@&saddr=%f,%f", [self.address stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding], [appDelegate.lat floatValue], [appDelegate.lon floatValue]]];
  8. [[UIApplication sharedApplication] openURL:myURL];
  9. }

URL: http://www.espinallab.com

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.