我正在使用新的 MKMapItem,一切似乎都很好。当我将“openMapsWithItems”与该选项一起使用时,我会打开地图应用程序,其中包含从“plc”到“plc3”的路线,但我想使用所有 3 个地标,例如开始 -> 点 -> 目的地。那可能吗?
NSMutableArray *arrayMapItem = [[NSMutableArray alloc] init];
MKPlacemark *plc = [[MKPlacemark alloc] initWithCoordinate:CLLocationCoordinate2DMake(43.77398, 11.248) addressDictionary:nil];
MKMapItem *partenza = [[MKMapItem alloc] initWithPlacemark:plc];
[partenza setName:@"Piazza"];
MKPlacemark *plc2 = [[MKPlacemark alloc] initWithCoordinate:CLLocationCoordinate2DMake(43.780, 11.248) addressDictionary:nil];
MKMapItem *mezzo = [[MKMapItem alloc] initWithPlacemark:plc2];
[mezzo setName:@"Mezzo"];
MKPlacemark *plc3 = [[MKPlacemark alloc] initWithCoordinate:CLLocationCoordinate2DMake(43.783, 11.248) addressDictionary:nil];
MKMapItem *destinazione = [[MKMapItem alloc] initWithPlacemark:plc3];
[destinazione setName:@"Destinazione"];
[arrayMapItem addObject:partenza];
[arrayMapItem addObject:mezzo];
[arrayMapItem addObject:destinazione];
NSDictionary* options = [[NSDictionary alloc] initWithObjectsAndKeys:
MKLaunchOptionsDirectionsModeDriving,
MKLaunchOptionsDirectionsModeKey, nil];
[MKMapItem openMapsWithItems:arrayMapItem launchOptions:options];