Please, how should I achieve it?
I want to draw a gradient circle, the color is white, and the alpha starts to change according to the specified(0%, 10%, 30%) position.
I tried CGContextDrawRadialGradient, but the effect is wrong. Below is my code and Demo.
code:
CGFloat colors[] = {
1, 1, 1, 0.35,
1, 1, 1, 0.10,
1, 1, 1, 0.0,
};
CGGradientRef gradient = CGGradientCreateWithColorComponents(rgb, colors, NULL, 3);
CGContextRef graCtx = UIGraphicsGetCurrentContext();
CGContextDrawRadialGradient(graCtx, gradient, self.center, 75, self.center, 100, kCGGradientDrawsBeforeStartLocation | kCGGradientDrawsAfterEndLocation);
CGColorSpaceRelease(rgb);
sample: