截至目前,我使用以下代码成功地从我的应用程序中使用地图应用程序生成了路线:
NSString *formattedGroceryAddress = [[NSString stringWithFormat:@"%@",((EnhancedUIActionSheet *)actionSheet).grocery.address] stringByReplacingOccurrencesOfString:@" " withString:@"+"];
NSString *routeString = [NSString stringWithFormat:@"http://maps.google.com/maps?saddr=%f,%f&daddr=%@",localDataHelper.userLocation.coordinate.latitude,localDataHelper.userLocation.coordinate.longitude,formattedGroceryAddress];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:routeString]];
它会使用适当的选项打开地图应用程序driving方向。问题是,我想用以下命令打开地图walking默认方向。也许我可以在请求中传递另一个参数来做到这一点。
有人知道怎么办吗?
Thanks !
好吧,我想我应该在提问之前更好地搜索!
您可以将 dirflg=w 添加到请求中,它将以步行模式启动地图应用程序。
这很有趣,因为苹果说他们只支持一些谷歌地图参数,不包括这个,但它实际上似乎有效!
有关 Google 地图参数的更多信息:http://mapki.com/wiki/Google_Map_Parameters
有关 iOS 应用程序中的地图链接的更多信息:http://developer.apple.com/library/ios/#featuredarticles/iPhoneURLScheme_Reference/Articles/MapLinks.html
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)