Overlay MKMapView A polyline is applied over a road mark

I am making a navigation application by drawing a direction between two points. I am successfully archiving functionality.

But the direction line is drawn over the road mark and this mark cannot be read as shown in the figure below.

enter image description here

this is my overlay code

- (MKOverlayView *)mapView:(MKMapView *)mapView viewForOverlay:(id<MKOverlay>)overlay
{
    MKPolylineView *overlayView = [[MKPolylineView alloc] initWithPolyline:overlay];
    overlayView.lineWidth = 10.0f;
    //overlayView.strokeColor = [[UIColor redColor] colorWithAlphaComponent:0.5f];
    overlayView.strokeColor = [UIColor redColor];
    return overlayView;
}

I can overcome this with a transparent string, but this is not an efficient way.

The best way is to draw a line between the map layer and the MKMapView label layer, but I don't know how to do this.

So please help. Thanks.

+4
source share
1 answer

, iOS- ( Google, ), iOS 7, , , , addOverlay:level:. MKMapView

[theMapView addOverlay:theOverlay level:MKOverlayLevelAboveRoads];
+6

All Articles