-
-
Save danielphillips/3734823 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (IBAction)showWalkingDirections:(id)sender { | |
if ([self.parkingDetails.mapItem respondsToSelector:@selector(openInMapsWithLaunchOptions:)]) { | |
NSDictionary *launchOptions = @{ | |
MKLaunchOptionsDirectionsModeKey : MKLaunchOptionsDirectionsModeWalking, | |
MKLaunchOptionsMapTypeKey : [NSNumber numberWithInt:MKMapTypeStandard] | |
}; | |
[self.parkingDetails.mapItem openInMapsWithLaunchOptions:launchOptions]; | |
} else { | |
NSString *mapURL = @"http://maps.google.com/maps?"; | |
mapURL = [mapURL stringByAppendingFormat:@"saddr=%f,%f&", | |
self.mapView.userLocation.location.coordinate.latitude, | |
self.mapView.userLocation.location.coordinate.longitude]; | |
mapURL = [mapURL stringByAppendingFormat:@"daddr=%f,%f&", | |
self.parkingDetails.location.coordinate.latitude, | |
self.parkingDetails.location.coordinate.longitude]; | |
mapURL = [mapURL stringByAppendingFormat:@"dirflg=w"]; | |
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:mapURL]]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment