开发者

Presenting a walkway from position A to B in my app

So I have an iPhone app which should aid the user to find a convenient walkway from his/her own position to a given destination. As I have learnt, MKMapView does not provide an easy way to infer a preferred walking route from A to B.

I can live with terminating my own app and launch the native map application on the iPhone, but in that case I would like to equip the map application with two coordinat开发者_运维知识库es so that the user can find his/her way.

Any suggestions to how I should go about this task?


To launch the native map app use:

NSString *googleMapsURL = [NSString stringWithFormat:@"http://maps.google.com/?saddr=%1.6f,%1.6f&daddr=%1.6f,%1.6f",
                               start.latitude, start.longitude, destination.latitude, destination.longitude];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:googleMapsURL];

where start is the user location and destination is, well, the destination. For walking directions, you can add &dirflg=w (still in beta according to wiki). Here are some more parameters you can use.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜