我使用此代码在 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];
}
问题是导航栏总是隐藏的,并且任何按钮都会将视图返回给您的应用程序。那么,如何关闭 MapKit 驾驶模式?