1

I need to create a Map Navigation application with turn by turn navigation features like Apple's map.

I know we can open the Maps application to show address and route between source and destination location which provides direction for routing.

Here is code i have used.

-(void)openMaps
{

 MKPlacemark *place1 = [[MKPlacemark alloc] 
initWithCoordinate:CLLocationCoordinate2DMake(38.40904,-121.36562)  
   addressDictionary:nil];

MKMapItem *mapItem1 = [[MKMapItem alloc]initWithPlacemark:place1];

MKPlacemark *place2 = [[MKPlacemark alloc]
   initWithCoordinate:CLLocationCoordinate2DMake(38.41406,-121.36305)
   addressDictionary:nil];
MKMapItem *mapItem2 = [[MKMapItem alloc]initWithPlacemark:place2];

NSArray *mapItems = @[mapItem1, mapItem2];

NSDictionary *options = @{
   MKLaunchOptionsDirectionsModeKey:MKLaunchOptionsDirectionsModeDriving,
   MKLaunchOptionsMapTypeKey:[NSNumber numberWithInteger:MKMapTypeSatellite],
   MKLaunchOptionsShowsTrafficKey:@YES 
   };

[MKMapItem openMapsWithItems:mapItems launchOptions:options];

}

But it opens Maps application to show turn by turn navigation.

Is it possible to show this feature without opening maps i.e. inside custom application?

Thanks

4

0 回答 0