视图渐变

CAGradientLayer *gradientLayer = [CAGradientLayer layer];
gradientLayer.colors = @[(__bridge id)[[UIColor blackColor] colorWithAlphaComponent:0.3].CGColor, (__bridge id)[UIColor clearColor].CGColor];
gradientLayer.locations = @[@0.5, @0.9];
gradientLayer.startPoint = CGPointMake(0, 0);
gradientLayer.endPoint = CGPointMake(0, 0.5);
gradientLayer.frame = _coverImage.bounds;
[_coverImage.layer addSublayer:gradientLayer];

你可能感兴趣的:(视图渐变)