Reputation: 173
I want to open native map application from my application by Clicking on Button. How i can do This ?
Upvotes: 2
Views: 944
Reputation: 2002
NSString *title = @"any title";
float latitude = 75.4634;
float longitude = 69.43425;
int zoom = 13;
NSString *stringURL = [NSString stringWithFormat:@"http://maps.google.com/maps?q=%@@%1.6f,%1.6f& z=%d", title, latitude, longitude, zoom];
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];
Upvotes: 1
Reputation: 2907
Have a look at below code, it will satisfy your need.
NSString *title = @"title";
float latitude = 35.4634;
float longitude = 9.43425;
int zoom = 13;
NSString *stringURL = [NSString stringWithFormat:@"http://maps.google.com/maps?q=%@@%1.6f,%1.6f&z=%d", title, latitude, longitude, zoom];
NSURL *url = [NSURL URLWithString:stringURL];
[[UIApplication sharedApplication] openURL:url];
Cheers!
Upvotes: 1
Reputation: 849
NSString *mapUrl= [NSString stringWithFormat:@"https://maps.google.com/maps?ll=%f,%f",Latitude ,Longitude];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:mapUrl]];
Upvotes: 3