I'm making a custom control and it was fine til my client says "I want it with gradients". So here I am. I need to draw an angle and fill it with gradient color. My previous code was this:
- (void)drawRect:(CGRect)rect{
CGContextBeginPath(context);
CGContextMoveToPoint(context, self.center.x, self.center.y);
CGContextAddArc(context, self.center.x, self.center.y, radius, radians(180), radians(minValue - 180), 0);
CGContextClosePath(context);
CGContextSetFillColorWithColor(context, gray);
CGContextFillPath(context);
}
With the CGContextAddArc() function I can draw my angle and paint it with CGContextSetFillColorWithColor() function, then close the path and voilá. But now I need to painted with gradients. I know that maybe I should use CGContextDrawRadialGradient, but don't know how to use it with an arc. I've been tried to figured out this with other question in StackOVerFlow and reading the doc, but I just can't get it.