47.渐变色
2021-01-25 本文已影响0人
bytebytebyte
CAGradientLayer *gl = [CAGradientLayer layer];
gl.frame = CGRectMake(0, 0, 95, 60);
gl.startPoint = CGPointMake(0, 0);
gl.endPoint = CGPointMake(1, 1);
gl.colors = @[
(__bridge id)[UIColor colorWithRed:247/255.0 green:201/255.0 blue:104/255.0 alpha:1.00].CGColor,
(__bridge id)[UIColor colorWithRed:255/255.0 green:179/255.0 blue:64/255.0 alpha:1.00].CGColor,
];
gl.locations = @[@(0),@(1.f)];
[self.layer insertSublayer:gl atIndex:0];