![](/img/trans.png)
[英]In iOS6, trouble forcing ViewController to certain interfaceOrientation when pushed on stack
[英]Trouble to dismiss MapKit 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];
}
问题在于,navigationBar始终处于隐藏状态,并且任何按钮都会将视图关闭并返回给您的应用程序。 那么,如何关闭MapKit DrivingMode?
您误解了openMapsWithItems在做什么。 该用户不再在您的应用中。 您已将它们发送到Apple的Map.app。 消除它的唯一方法是用户按下主页按钮。
@Marckaraujo:我完全同意@craig。一旦从应用程序内部使用行车路线模式,就无法返回到应用程序。您只需要按下主屏幕按钮,然后回到您在应用程序中留下的位置即可。
我也对这个问题感到震惊并进行了大量搜索,但这只是最终的解决方案。主页按钮。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.