从iPhone打开谷歌地图并显示路线 [英] Open Google Maps from iPhone and show route

查看:91
本文介绍了从iPhone打开谷歌地图并显示路线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何从我的iphone应用程序打开Goog​​le地图,以便Google地图在您到达网页时显示路线?

I was wondering how I can open Google Maps from my iphone app so that Google Maps shows the route when you arrive at the web page?

今天我使用代码显示坐标。

Today I use code that only shows the coordinate.

        NSString *latlong = [NSString stringWithString: @"59.33267,18.07361"];
        NSURL *url = [[[NSURL alloc] initWithString:[NSString stringWithFormat: @"http://maps.google.com/maps?ll=%@", [latlong stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding] ]] autorelease];
        [[UIApplication sharedApplication] openURL:url];


推荐答案

对url使用以下格式(必须同时指定两者)路线起点和终点):

Use the following format for url (you must specify both route start and endpoint):

"http://maps.google.com/maps?daddr=%f,%f&saddr=%f,%f"

这篇关于从iPhone打开谷歌地图并显示路线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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