效果图:
主要代码:
//通过CAGradientLayer 设置渐变的背景。
CAGradientLayer *layer = [CAGradientLayer new];
//colors存放渐变的颜色的数组
layer.colors=@[(__bridge id)[UIColor redColor].CGColor,(__bridge id)[UIColor whiteColor].CGColor];
/**
* 起点和终点表示的坐标系位置,(0,0)表示左上角,(1,1)表示右下角
*/
layer.startPoint = CGPointMake(0.5, 0);
layer.endPoint = CGPointMake(0.5, 1);
layer.frame = self.view.bounds;
[self.view.layer addSublayer:layer];
我的业余技术微信公众号:YKJGZH,欢迎大家进入
5497

被折叠的 条评论
为什么被折叠?



