具有特定位置的MKMapItem [英] MKMapItem with specific Location

查看:114
本文介绍了具有特定位置的MKMapItem的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何为iOS6启动默认地图应用并将其传递到自定义位置?

How can I launch the default maps app for iOS6 and pass it a custom location?

例如:

[[MKMapItem setLocation:MyLocation] openInMapsWithLaunchOptions:nil];

我按照这里的例子,但无法弄明白。 如何在我自己的原生应用程序中启动Google Maps iPhone应用程序?

I followed the example here, but was unable to figure it out. How can I launch the Google Maps iPhone application from within my own native application?

推荐答案

这是用自定义位置打开Maps原生应用程序的代码:

Here is the code to open the Maps native application with a custom location:

double latitude = 35.0;
double longitude = 1.0;
MKPlacemark *placemark = [[[MKPlacemark alloc] initWithCoordinate:CLLocationCoordinate2DMake(latitude, longitude) addressDictionary:nil] autorelease];
MKMapItem *mapItem = [[[MKMapItem alloc] initWithPlacemark:placemark] autorelease];
[mapItem setName:@"Name of your location"];
[mapItem openInMapsWithLaunchOptions:nil];

这篇关于具有特定位置的MKMapItem的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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