渐变色设置

来源:互联网 发布:淘宝店铺申诉入口 编辑:程序博客网 时间:2024/05/16 11:02

//渐变色

CAGradientLayer *bottomShadow = [[CAGradientLayer alloc] init];

bottomShadow.frame = CGRectMake(2.0, 2.0, 60.0, 60.0);

CGColorRef black = [UIColor redColor].CGColor;

CGColorRef blue = [UIColor blueColor].CGColor;

bottomShadow.colors = [NSArray arrayWithObjects:(__bridge id)black,(__bridge id)blue, nil];

//视图

UIView *sepLine = [[UIView alloc] init ];

sepLine.frame = CGRectMake(20.0, 40.0, 60.0, 60.0);

[sepLine.layer addSublayer:bottomShadow];

[self.view addSubview:sepLine];



0 0
原创粉丝点击