开发者

Presenting a walkway from position A to B in my app

开发者 https://www.devze.com 2023-01-13 17:24 出处:网络
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 pre

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

精彩评论

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

关注公众号