2013-03-13 61 views
0

我添加了MapView和和顯示當前位置所需的條件,並且按鈕功能從蘋果文檔中添加了此方法。ios6中的mapView中的路徑追蹤

- (IBAction)refreshMapMethod:(id)sender 

{

double latitude = 39.281516; 
double longitude =-76.580806; 


MKPlacemark *placemark = [[MKPlacemark alloc] initWithCoordinate:CLLocationCoordinate2DMake(latitude, longitude) addressDictionary:nil]; 
MKMapItem *mapItem = [[MKMapItem alloc] initWithPlacemark:placemark]; 
[mapItem setName:@"Name of your location"]; 
[mapItem openInMapsWithLaunchOptions:nil]; 

///// 
//////// 

CLLocation* fromLocation = mapItem.placemark.location; 

// Create a region centered on the starting point with a 10km span 

MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(fromLocation.coordinate, 10000, 10000); 

// Open the item in Maps, specifying the map region to display. 

[MKMapItem openMapsWithItems:[NSArray arrayWithObject:mapItem] 
       launchOptions:[NSDictionary dictionaryWithObjectsAndKeys: 
           [NSValue valueWithMKCoordinate:region.center], MKLaunchOptionsMapCenterKey, 
           [NSValue valueWithMKCoordinateSpan:region.span], MKLaunchOptionsMapSpanKey, nil]]; 

}

按下按鈕後,我得到新的觀點與所有喜歡的地圖視圖添加註釋,長按,跟蹤路徑的功能以及更多。如何這正在發生小功能

任何想法請求幫助。

回答

0

openInMapsWithLaunchOptions:openMapsWithItems:launchOptions:都將打開Apple Maps應用程序(並將您的應用程序置於後臺)。可能這不是你想要的。