I am working on a navigation app to show turn by turn driving directions. In iOS 6 we have to pass data to ios map app, but i want to show it without leaving the app.
Apple has introduced new directions API in iOS 7, so now in iOS 7 is it possible to show Turn By Turn Navigation within the app(in MKMapView) ?
In iOS 7, you can use something like this to render driving direction within your app:
MKDirectionsRequest *request = [[MKDirectionsRequest alloc] init];
[request setSource:[MKMapItem mapItemForCurrentLocation]];
[request setDestination:myMapItem];
[request setTransportType:MKDirectionsTransportTypeAny];
[request setRequestsAlternateRoutes:YES];
MKDirections *directions = [[MKDirections alloc] initWithRequest:request];
[directions calculateDirectionsWithCompletionHandler:^(MKDirectionsResponse *response, NSError *error) {
if (!error) {
for (MKRoute *route in [response routes]) {
[myMapView addOverlay:[route polyline] level:MKOverlayLevelAboveRoads];
}
}
}];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With