Dibuja CAGradient dentro de MKPolyLineView
Solo tengo un problema con mi MKPolyLineView. Simplemente trato de hacer un gradiente de color a la polilínea, pero con CAGradient no funciona. Yo subclases MKPolylineView y redibujado en
- (void)drawMapRect:(MKMapRect)mapRect zoomScale:(MKZoomScale)zoomScale inContext:(CGContextRef)context
UIColor *darker = [UIColor blackColor];
CGFloat baseWidth = self.lineWidth / zoomScale;
// draw the dark colour thicker
CGContextAddPath(context, self.path);
CGContextSetStrokeColorWithColor(context, darker.CGColor);
CGContextSetLineWidth(context, baseWidth * 1.5);
CGContextSetLineCap(context, self.lineCap);
CGContextStrokePath(context);
// now draw the stroke color with the regular width
CGContextAddPath(context, self.path);
CGContextSetStrokeColorWithColor(context, self.strokeColor.CGColor);
CGContextSetLineWidth(context, baseWidth);
CGContextSetLineCap(context, self.lineCap);
CGContextStrokePath(context);
[super drawMapRect:mapRect zoomScale:zoomScale inContext:context];
}
pero incluso eso no funciona (StrokeColor = rojo). ¿Alguna idea de cómo obtener un gradiente en la polilínea? (Highcolor, centercolor, lowcolor)
Gracias a todos.