0

I have an issue with the gradient color, I'm not able to make the gradient color appear as circular, it always appear like linear, i need the exact gradient in the following image:

enter image description here

PS: this is the code i use:

UIView *view = [[UIView alloc] initWithFrame:self.view.frame];
CAGradientLayer *gradient = [CAGradientLayer layer];
gradient.frame = view.bounds;
gradient.startPoint = CGPointMake(0.0,0.4);
gradient.endPoint = CGPointMake(0.0,0.6);
view.layer.masksToBounds = YES;
gradient.colors = [NSArray arrayWithObjects:(id)[[UIColor colorWithRed:153.0/255.0 green:204.0/255.0 blue:0.0/255.0 alpha:1.0] CGColor], (id)[[UIColor whiteColor] CGColor], nil];
[view.layer insertSublayer:gradient atIndex:0];
[self.view addSubview:view];
Mutawe
  • 6,464
  • 3
  • 47
  • 90
  • CAGradientLayer doesn't support radial gradients, you can subclass CALayer and use `CGContextDrawRadialGradient` like here for example http://stackoverflow.com/a/26924839 – TonyMkenu Dec 04 '14 at 21:18

1 Answers1

-1

There is a CGContextDrawRadialGradient in CGContext. I hope it will help you

Mateusz
  • 1,222
  • 11
  • 22