开发者

"Current Location" on iPhone Maps.app

I am using this code to run the maps.app from my app.

NSString* urlStr = [NSString stringWithFormat: @"http://maps.go开发者_StackOverflowogle.com/maps?saddr=%f,%f&daddr=%f,%f", s_lat, s_long, d_lat, d_long];

[[UIApplication sharedApplication] openURL: [NSURL URLWithString:urlStr]];

The issue is that I didnt manage to get the current location. I want something like this:

 poi1.url = [NSString stringWithFormat:@"http://maps.google.com/maps?saddr=Current Location&daddr=%f,%f",lat,lon];


Have you tried appending the your label after the position data?

http://maps.google.com/maps?q=37.771008,+-122.41175+(You+can+insert+your+text+here)&iwloc=A&hl=en

Edit: And don't forget to encode your URL correctly!

NSURL* url = [[NSURL alloc] initWithString:[addr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜