UIView *view=[[UIView alloc]init];
[self.view addSubview:view];
CAGradientLayer *gl = [CAGradientLayer layer];
gl.frame = CGRectMake(0,0,WIDTH,165);
gl.startPoint = CGPointMake(0, 1);
gl.endPoint = CGPointMake(1, 0);
gl.colors = @[(__bridge id)[UIColor colorWithRed:30/255.0 green:133/255.0 blue:226/255.0 alpha:1].CGColor, (__bridge id)[UIColor colorWithRed:49/255.0 green:179/255.0 blue:231/255.0 alpha:1].CGColor];
gl.locations = @[@(0), @(1.0f)];
[view.layer addSublayer:gl];
view.sd_layout.leftSpaceToView(self.view, 0).topSpaceToView(self.view, 0).rightSpaceToView(self.view, 0).heightIs(165);
[self.view sendSubviewToBack:view];
网友评论