使用纬度和经度打开iOS地图

使用纬度和经度打开iOS地图,第1张

概述我使用这个代码打开地图应用程序 NSString* versionNum = [[UIDevice currentDevice] systemVersion]; NSString *nativeMapScheme = @"maps.apple.com"; if ([versionNum compare:@"6.0" options:NSNumericSearch] == NSOrd 我使用这个代码打开地图应用程序
Nsstring* versionNum = [[UIDevice currentDevice] systemVersion];    Nsstring *nativeMapScheme = @"maps.apple.com";    if ([versionNum compare:@"6.0" options:NSNumericSearch] == NSOrderedAscending){        nativeMapScheme = @"maps.Google.com";    }    Nsstring* url = [Nsstring stringWithFormat:@"http://%@/maps?ll=%f,%f",nativeMapScheme,40.739490,-73.991154];    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];

看来它的效果很好,但是这个位置上没有引脚.如何添加引脚,我想在请求中有其他参数?

解决方法 如果您希望将引脚放置在Apple的Google Maps应用程序上,请在URL中使用“q”而不是“ll”.

你可以这样使用

Nsstring* url = [Nsstring stringWithFormat:@"http://%@/maps?q=%f,-73.991154];
总结

以上是内存溢出为你收集整理的使用纬度经度打开iOS地图全部内容,希望文章能够帮你解决使用纬度和经度打开iOS地图所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1096135.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-28
下一篇 2022-05-28

发表评论

登录后才能评论

评论列表(0条)

保存