简体   繁体   English

无法关闭MapKit iOS6

[英]Trouble to dismiss MapKit iOS6

I use this code to create driving mode directions in iOS6: 我使用以下代码在iOS6中创建行驶模式说明:

Class itemClass = [MKMapItem class];

    if (itemClass && [itemClass respondsToSelector:@selector(openMapsWithItems:launchOptions:)]) {
        MKMapItem *currentLocationItem = [MKMapItem mapItemForCurrentLocation];
        NSString *Latitude = [[_locationString componentsSeparatedByString:@","] objectAtIndex:0];
        NSString *Longitude = [[_locationString componentsSeparatedByString:@","] objectAtIndex:1];
        MKPlacemark *place = [[MKPlacemark alloc] initWithCoordinate:CLLocationCoordinate2DMake([Latitude doubleValue], [Longitude doubleValue]) addressDictionary:nil];
        MKMapItem *destinamtionLocItem = [[MKMapItem alloc] initWithPlacemark:place];

        destinamtionLocItem.name = _titleString;

        NSArray *mapItemsArray = @[currentLocationItem, destinamtionLocItem];
        NSDictionary *dictForDirections = @{MKLaunchOptionsDirectionsModeKey: MKLaunchOptionsDirectionsModeDriving};

        [MKMapItem openMapsWithItems:mapItemsArray launchOptions:dictForDirections];
}

The problem is that the navigationBar is always hidden and any button dismiss the view back to your application. 问题在于,navigationBar始终处于隐藏状态,并且任何按钮都会将视图关闭并返回给您的应用程序。 So, How to dismiss the MapKit drivingMode? 那么,如何关闭MapKit DrivingMode?

在此处输入图片说明

You've misunderstood what openMapsWithItems is doing. 您误解了openMapsWithItems在做什么。 The user is no longer in your app. 该用户不再在您的应用中。 You've sent them over to Apple's Map.app. 您已将它们发送到Apple的Map.app。 The only way to dismiss it is for the user to press the home button. 消除它的唯一方法是用户按下主页按钮。

@Marckaraujo: i completely agree with @craig .There is no way back to the aplication once you use driving directions mode from inside your app.You only have to press home button and then come back to where you left in your application. @Marckaraujo:我完全同意@craig。一旦从应用程序内部使用行车路线模式,就无法返回到应用程序。您只需要按下主屏幕按钮,然后回到您在应用程序中留下的位置即可。

i too got struck with this issue and searched a lot but this is the final solution only.Home Button. 我也对这个问题感到震惊并进行了大量搜索,但这只是最终的解决方案。主页按钮。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM