标签:
{
CAGradientLayer *_layer;
}
//创建渐变层
_layer =[CAGradientLayer layer];
_layer.frame=self.view.frame;
//设置渐变开始的坐标
_layer.startPoint=CGPointMake(0.0, 0.4);
//设置渐变结束的坐标
_layer.endPoint=CGPointMake(0.0, 1.0);
//将渐变层添加到视图层上
[self.view.layer insertSublayer:_layer atIndex:0];
UIColor *color1 =[UIColor colorWithRed:0.427451 green:0.737255 blue:0.643137 alpha:1];
UIColor *color2 =[UIColor colorWithRed:0.572549 green:0.345098 blue:0.74902 alpha:1];
//设置渐变层的颜色数组
_layer.colors=@[(id)[color1 CGColor ],(id)[color2 CGColor]];
标签:
原文地址:http://www.cnblogs.com/LQCQ-Silent/p/4890033.html