ios6中mapView中的路径跟踪



我添加了MapView和显示当前位置的必要条件,并添加了按钮功能,只是这个方法来自apple文档。

- (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]];

}

按下按钮后,我得到了新的视图与所有的功能,如添加注释在地图视图与长按,跟踪路径和更多。这是如何发生的小功能

有什么想法请帮忙

openInMapsWithLaunchOptions:openMapsWithItems:launchOptions:都将打开Apple Maps应用程序(并将应用程序置于后台)。这可能不是你想要的。

最新更新