I was wondering if it is possible to implement the turn by turn navigation in the app itself.
At the moment I’m using this code.
-(void)viewWillAppear:(BOOL)animated{
//home location
CLLocationCoordinate2D coords =
CLLocationCoordinate2DMake(51.044242,5.621653);
MKPlacemark *place = [[MKPlacemark alloc]
initWithCoordinate:coords addressDictionary:nil];
MKMapItem *mapItem = [[MKMapItem alloc]initWithPlacemark:place];
//current location
MKMapItem *mapItem2 = [MKMapItem mapItemForCurrentLocation];
NSArray *mapItems = @[mapItem, mapItem2];
NSDictionary *options = @{
MKLaunchOptionsDirectionsModeKey:MKLaunchOptionsDirectionsModeDriving,
MKLaunchOptionsMapTypeKey:
[NSNumber numberWithInteger:MKMapTypeStandard],
MKLaunchOptionsShowsTrafficKey:@YES
};
[MKMapItem openMapsWithItems:mapItems launchOptions:options];
}
This works great, but it opens the native app application. Is it possible to show this in the app itself without leaving the app?
Kind regards
For show mapview functions within app. use MKMapView instead of using MKMapItem that will redirect you to device`s native application,
For draw route on map view follow bellow links,
1) MKMapView
2) Drawing polyines or routes on Mapview
you can draw path using draw lines on mapview`s overlay you can got brife idea about that in above link and for overlay on MapView refer this.
As per your question you can draw path turn by turn using that two turning points on map.
You can found all mapView related class references`s official links over
here.