iPhone应用程序:使用地图显示方向 [英] iPhone App :show direction using Map

查看:147
本文介绍了iPhone应用程序:使用地图显示方向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的iPhone应用程序中如何显示从当前位置到终点的路线?

in My iPhone App How Can I show directions from current location to End Point?

是否有任何内置组件或设施可用于iPhone,可显示地图和方向使用GPS和内置指南针?

is there any built in component or facility available on iphone which can show maps and direction using GPS and built in compass?

推荐答案

如果您的意思是基于两点将用户带到地图应用程序,那么您可以这样做: p>

If you mean taking the user to the maps application based on two points, then you can do it like this:


  1. 创建一个如下所示的NSURL:
    NSURL * URL = [NSURL URLWithString:@http: //maps.google.com/maps?saddr=%f,%f&daddr=%f,%f];
    您插入起始地址和目的地(以lat 。和适当的。)。

  2. 告诉您的应用程序打开URL
    [[UIApplication sharedApplication] openURL:URL];

  1. Create an NSURL that looks like this: NSURL *URL = [NSURL URLWithString:@"http://maps.google.com/maps?saddr=%f,%f&daddr=%f,%f"]; You plug in your starting address and destination (in lat. and long.) appropriately.
  2. Tell your application to open the URL [[UIApplication sharedApplication] openURL:URL];

它会自动带您到地图应用程序!

It should take you to the maps application automatically!

这篇关于iPhone应用程序:使用地图显示方向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆