使用导航栏和barbuttonitem打开Apple地图

时间:2013-05-24 18:11:59

标签: ios objective-c navigation apple-maps

当我按下按钮时,我有一些打开Apple Maps的代码,但我想在屏幕顶部实现一个导航控制器,以便我可以返回上一页。是否有可能做到这一点,或者Apple原生应用程序是否有自己不可编辑的方式?

感谢。所有帮助表示赞赏。这是我用来打开地图的代码。

- (IBAction)mapPressed:(id)sender
{

CLLocationCoordinate2D location = CLLocationCoordinate2DMake(25.613336,-80.398437);
//Apple Maps, using the MKMapItem class
MKPlacemark *placemark = [[MKPlacemark alloc] initWithCoordinate:location addressDictionary:nil];
MKMapItem *item = [[MKMapItem alloc] initWithPlacemark:placemark];
item.name = @"Zoo Miami";
[item openInMapsWithLaunchOptions:nil];

//I need an navigation bar to open with the Apple map so that I could go back to my app without exiting the map and re-entering my app.
}

1 个答案:

答案 0 :(得分:2)

很遗憾,您无法将动作添加到任何其他应用。为此,您需要在自己的View Controller中实现MKMapView