iPhone,每种模式都需要时间,步行,自行车和公共交通方向

ale*_*ine 3 iphone driving-directions

我正在使用以下网址来获取两个地点之间的行车路线.

 NSString* apiUrlStr = [NSString stringWithFormat:@"http://maps.google.com/maps?output=dragdir&saddr=%@&daddr=%@", saddr, daddr];
Run Code Online (Sandbox Code Playgroud)

在上述查询中需要做哪些更改才能获得自行车,步行或公共交通的方向以及相应的距离,两地之间所需的时间?

在此先感谢您的帮助.

vig*_*o24 6

你必须使用"dirflg =?" 参数,其中"?" 可:

dirflg Route type.
dirflg=h Switches on "Avoid Highways" route finding mode.
dirflg=t Switches on "Avoid Tolls" route finding mode.
dirflg=r Switches on "Public Transit" - only works in some areas. Can also set date and time info described below.
dirflg=w Switches to walking directions - still in beta.
dirflg=b Switches to biking directions - only works in some areas and still in beta.

还有许多其他参数可用,请阅读Google Maps Parameters文档,但当然并非所有这些都支持Maps本机API(在每个iOS版本中都会更新).由您来测试它们,因为官方Apple文档并不总是与所有功能保持同步.