[英]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.