我正在MKMapView上绘制MKPolyLine。在iOS 10之前,它一直正常工作。在iOS 10中,除了路线之外,它还显示颜色补丁。
- (MKOverlayRenderer *)mapView:(MKMapView *)mapView rendererForOverlay:(id<MKOverlay>)overlay
{
[![enter image description here][1]][1]if ([overlay isKindOfClass:[MKPolyline class]]) {
MKPolyline *route = overlay;
@try {
MKPolylineRenderer *routeRenderer = [[MKPolylineRenderer alloc] initWithPolyline:route];
routeRenderer.strokeColor = [UIColor colorWithRed:20/255.0 green:153/255.0 blue:255/255.0 alpha:1.0];
routeRenderer.lineWidth = 3;
[routeRenderer setNeedsDisplay];
return routeRenderer;
}
@catch (NSException *exception) {
NSLog(@"exception :%@",exception.debugDescription);
}
}
else return nil;
}