【发布时间】:2015-04-12 17:20:15
【问题描述】:
我是 iOS 的新手我想制作一个包含地图套件导航的应用程序。如果用户设备有谷歌地图应用程序,我想打开谷歌地图的导航 url。如果它不包含那么我想打开 Apple 地图在这里我写了一个类似 as 的代码
-(IBAction)navigationButtonPressed:(id)sender
{
if ([[UIApplication sharedApplication] canOpenURL:
[NSURL URLWithString:@"comgooglemaps://"]])
{
NSString *urlString=[NSString stringWithFormat:@"comgooglemaps://?center=%f,%f&zoom=14&views=traffic",self.latitude,self.longitude];
[[UIApplication sharedApplication] openURL:
[NSURL URLWithString:urlString]];
}
else
{
NSString *string = [NSString stringWithFormat:@"http://maps.apple.com/?ll=%f,%f",self.latitude,self.longitude];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:string]];
}
}
但是在这里我想打开谷歌地图或苹果地图,并在用户当前位置和选定位置之间逐个方向打开它怎么可能请给我解决方案。
【问题讨论】:
标签: ios google-maps mapkit