- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control { MKPointAnnotation* pin = (MKPointAnnotation*)view.annotation; CLLocationCoordinate2D endingCoord = CLLocationCoordinate2DMake(pin.coordinate.latitude, pin.coordinate.longitude); MKPlacemark *endLocation = [[MKPlacemark alloc] initWithCoordinate:endingCoord addressDictionary:nil]; MKMapItem *endingItem = [[MKMapItem alloc] initWithPlacemark:endLocation]; endingItem.name = pin.title; NSMutableDictionary *launchOptions = [NSMutableDictionary new]; [launchOptions setObject:MKLaunchOptionsDirectionsModeDriving forKey:MKLaunchOptionsDirectionsModeKey]; [endingItem openInMapsWithLaunchOptions:launchOptions]; }
이렇게하면 자동으로 목적지가 지정되면서 경로찾기 화면이 나오게 된다.