我想通过点击按钮从我的应用程序打开本机地图应用程序。我该怎么做?
答案 0 :(得分:3)
NSString *mapUrl= [NSString stringWithFormat:@"https://maps.google.com/maps?ll=%f,%f",Latitude ,Longitude];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:mapUrl]];
答案 1 :(得分:1)
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];
答案 2 :(得分:1)
看看下面的代码,它将满足您的需求。
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];
干杯!