Joh*_*sma 7 google-maps map-directions ios
截至目前,我已使用以下代码从我的应用中使用地图应用成功生成路线:
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]];
Run Code Online (Sandbox Code Playgroud)
它会打开具有相应行车路线的地图应用.问题是,我想默认打开带有步行路线的地图.也许我可以在我的请求中传递另一个参数来做到这一点.
谁知道怎么样?
谢谢 !
Joh*_*sma 27
好吧,我想在问之前我应该更好地搜索一下!
您可以在请求中添加dirflg = w,它将以步行模式启动地图应用.
这很有趣,因为Apple表示他们只支持一些谷歌地图参数,不包括这个参数,但它实际上似乎有效!
有关Google地图参数的详细信息,请访问:http://mapki.com/wiki/Google_Map_Parameters
有关iOS应用的地图链接的详情,请访问:http://developer.apple.com/library/ios/#featuredarticles/iPhoneURLScheme_Reference/Articles/ MapLinks.html
归档时间: |
|
查看次数: |
12148 次 |
最近记录: |