如何在iPhone中的谷歌地图应用程序中显示地址

时间:2010-09-20 13:46:43

标签: iphone

我在iphone中加载了谷歌地图应用程序。我正在使用UIWebView Control在Control i中加载谷歌地图,如下面的

UIWebView *webView;
NSString *url = [NSString stringWithFormat: @"http://maps.google.com/maps?q=1600+Amphitheatre+Parkway,+Mountain+View,+CA"];
NSURL *aURL = [NSURL URLWithString:url];
webView.backgroundColor = [UIColor whiteColor];
NSURLRequest *aRequest = [NSURLRequest requestWithURL:aURL];
webView.dataDetectorTypes=UIWebViewNavigationTypeBackForward;
webView.scalesPageToFit = YES;
webView.autoresizesSubviews = YES;
webView.autoresizingMask=(UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth);
//set the web view and acceleration delagates for the web view to be itself
[webView loadRequest:aRequest];

它的针脚点工作正常。但是我想在谷歌地图应用程序中点击pin时显示地址。引脚(即其表示为A)。

任何人都可以帮助我吗?

提前致谢......

还有一个帮助我在“q”参数中给出的内容应该应用在谷歌地图的搜索框中。我想避免这种情况。任何帮助将不胜感激?

1 个答案:

答案 0 :(得分:2)

使用MapKit(MKMapView对象)而不是指向谷歌地图图像的webview,并使用Google Map API检索地址的坐标。

您可以使用AddressAnnotation对象创建一个引脚,并使用MKMapView的addAnnotation方法将其添加到地图中。

玩得开心!