0

我对渐变颜色有疑问,我无法使渐变颜色显示为圆形,它总是看起来像线性,我需要下图中的确切渐变:

在此处输入图像描述

PS:这是我使用的代码:

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];
4

1 回答 1

-1

中有一个CGContextDrawRadialGradientCGContext我希望它会帮助你

于 2014-12-04T12:18:09.320 回答