iOS View颜色渐变

来源:互联网 发布:7date数据恢复 注册码 编辑:程序博客网 时间:2024/05/22 00:55

UIView *backView = [[UIView alloc]initWithFrame:CGRectMake(100100200200)];

        backView.backgroundColor = [UIColor redColor];

        [_selectStationView addSubview:backView];

        

        CAGradientLayer *gradient = [CAGradientLayer layer];

        gradient.frame = backView.bounds;

        gradient.colors = [NSArray arrayWithObjects:(id)[UIColorredColor].CGColor,

                           (id)[UIColor greenColor].CGColor,

                           (id)[UIColor cyanColor].CGColor,nil];

        [backView.layer insertSublayer:gradient atIndex:0];

0 0
原创粉丝点击