美文网首页
透明渐变

透明渐变

作者: aofeilin | 来源:发表于2020-08-19 17:13 被阅读0次

CAGradientLayer *_bottomGradient = [CAGradientLayer layer];
// _bottomGradient.frame = CGRectMake(20, 20, 340, 340);
// UIColor *colorOne = [UIColor colorWithRed:(255.0/255.0) green:(255.0/255.0) blue:(255.0/255.0) alpha:0];
// UIColor *colorTwo = [UIColor colorWithRed:(255.0/255.0) green:(255.0/255.0) blue:(255.0/255.0) alpha:1];
// NSArray *colors = [NSArray arrayWithObjects:(id)colorOne.CGColor, colorTwo.CGColor, nil];
// _bottomGradient.colors = colors;
// _bottomGradient.startPoint = CGPointMake(0.5, 0);
// _bottomGradient.endPoint = CGPointMake(0.5, 1);
//
// //为透明度设置渐变效果
// UIView *view = [[UIView alloc] initWithFrame:CGRectMake(20, 20, 340, 340)];
// [view.layer insertSublayer:_bottomGradient atIndex:0];
// [self.view addSubview:view];

相关文章

网友评论

      本文标题:透明渐变

      本文链接:https://www.haomeiwen.com/subject/toldjktx.html