Skip to content

Instantly share code, notes, and snippets.

@jagbolanos
Created February 2, 2012 16:07
Show Gist options
  • Save jagbolanos/1724258 to your computer and use it in GitHub Desktop.
Save jagbolanos/1724258 to your computer and use it in GitHub Desktop.
Get Directions
// Delegate method from the CLLocationManagerDelegate protocol.
- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation
{
[self.locationManager stopUpdatingLocation];
NSString *urlString = [NSString stringWithFormat:@"http://maps.google.com/maps?saddr=%0.6f,%0.6f&daddr=%@,%@",
newLocation.coordinate.latitude,
newLocation.coordinate.longitude,
[[self.bar objectForKey:@"location"] objectForKey:@"lat"],
[[self.bar objectForKey:@"location"] objectForKey:@"lng"]];
[[UIApplication sharedApplication] openURL: [NSURL URLWithString: urlString]];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment