我想对CALayer施加渐变效果,就像附加的图像一样:
我必须在自定义链接中使用CAGradientLayer尝试创建自定义圆形视图。
CAGradientLayer *bottomLayer = [CAGradientLayer layer];
[bottomLayer setBackgroundColor:[UIColor clearColor].CGColor];
bottomLayer.cornerRadius = newRect.size.width/2;
bottomLayer.colors = [NSArray arrayWithObjects:(id)[self colorFromHexString:@"#FF6E3E" withAlpha:.4].CGColor,(id)[self colorFromHexString:@"#FF5F78" withAlpha:.40].CGColor, nil];
bottomLayer.startPoint = CGPointMake(0, 0);
bottomLayer.endPoint = CGPointMake(1, 1);
CIFilter *blur = [CIFilter filterWithName:@"CIGaussianBlur"];
[blur setDefaults];
bottomLayer.backgroundFilters = [NSArray arrayWithObject:blur];
bottomLayer.opacity = .4;
[[self layer] insertSublayer:bottomLayer atIndex:0];
bottomLayer.frame = newRect;
我的例外就像是我无法实现的附件图像。
预期行为: