i want display a point to point route inside my mapView, i use this code for create the route:
- (IBAction)backToYourCar {
MKPlacemark *sourcePlacemark =
after a day of research i have solved with this 3 steps:
self.mapView.delegate = self
).MKMapViewDelegate
- (MKOverlayRenderer *)mapView:(MKMapView *)mapView rendererForOverlay(id<MKOverlay>)overlay
:this is my implementation:
- (MKOverlayRenderer *)mapView:(MKMapView *)mapView rendererForOverlay:(id<MKOverlay>)overlay
{
if ([overlay isKindOfClass:[MKPolyline class]]) {
MKPolyline *route = overlay;
MKPolylineRenderer *routeRenderer = [[MKPolylineRenderer alloc] initWithPolyline:route];
routeRenderer.strokeColor = [UIColor blueColor];
return routeRenderer;
}
else return nil;
}
this method is automatically called by the delegate when you add the polyline on the map.