I have a project where I show directions between current location and another location on a map (MapKit)
All works well. And I can get alternative routes.
request.requestsAlternateRoutes = YES;
But when the user tap on a route I show an annotation with distance and some other info. I want to pass this spesific route to another view. How can I achieve that? Like the original Map app on iOS. I can get different routes, and tap on a route to get direction details.
I have googled a lot, and the closest example is this:
[directions calculateDirectionsWithCompletionHandler:^(MKDirectionsResponse *response, NSError *error) {
// Now handle the result
if (error) {
NSLog(@"There was an error getting your directions");
return;
}
_currentRoute = [response.routes firstObject];
But _currentRoute
is the first one. I want to let the user select currentRoute
on tap on the map.