在iphone sdk中加载地图

发布于 2024-10-05 11:08:12 字数 56 浏览 0 评论 0原文

在我的应用程序中,我需要通过传递地址、城市、州省代码和邮政编码来加载地图。 谁能告诉我我该怎么做?

In my app i need a map to loaded by passing address,city, state province code and postal code.
Can any one tell me how can i do it??

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

Saygoodbye 2024-10-12 11:08:12

您可以使用以下内容:-

  NSString* yourFullAddress = @"address,city, state province code and postal code";

    yourFullAddress =  [yourFullAddress stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];

    // Now create the URL string ...
    NSString* urlString = [NSString stringWithFormat:@"http://maps.google.com/maps?q=%@", yourFullAddress];

    // An the final magic ... openURL!
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString]];

或者如果您不想打开谷歌地图而是在您的 MKMapView 上设置坐标...您可以对您的地址进行地理编码以获取坐标并最终在您的 MKMapview 上设置坐标区域..

You can use below :-

  NSString* yourFullAddress = @"address,city, state province code and postal code";

    yourFullAddress =  [yourFullAddress stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];

    // Now create the URL string ...
    NSString* urlString = [NSString stringWithFormat:@"http://maps.google.com/maps?q=%@", yourFullAddress];

    // An the final magic ... openURL!
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString]];

Or in case u dont want to open google maps and rather set the coordinates on ur MKMapView ... u can GeoCode ur address to get the coordinates and finally set the coordinate region on ur MKMapview ..

等待我真够勒 2024-10-12 11:08:12

您是否尝试过在 Google 或 SO 上进行搜索?

这里是一个好的开始 http://blog.objectgraph.com/index.php/2009/04/02/iphone-sdk-30-playing-with-map-kit/

Did you even try searching on Google or SO?

A good start would be here http://blog.objectgraph.com/index.php/2009/04/02/iphone-sdk-30-playing-with-map-kit/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文