- (void)setNextStepBottomGradual{
//渐变的按钮
UIButton *lookBtn = [UIButton buttonWithType:(UIButtonTypeCustom)];
lookBtn.frame = CGRectMake(200, 300,100, 100);
[lookBtn setTitle:@"查看详情" forState:(UIControlStateNormal)];
//[lookBtn addTarget:self action:@selector(lookBtn) forControlEvents:(UIControlEventTouchUpInside)];
lookBtn.layer.shadowColor= kRGBA(239, 47, 27, 0.22).CGColor;
lookBtn.layer.shadowOffset=CGSizeMake(4, 4);
lookBtn.layer.shadowOpacity=1;
lookBtn.layer.shadowRadius= 5;
//渐变颜色
CAGradientLayer *gradientLayer = [CAGradientLayer layer];
gradientLayer.colors = @[
(id)kRGBA(255, 66, 73, 1).CGColor,
(id)kRGBA(236, 24, 32, 1).CGColor
];
gradientLayer.locations = @[@0.3, @1.0];
gradientLayer.startPoint = CGPointMake(0, 0);
gradientLayer.endPoint = CGPointMake(1.0, 0);
gradientLayer.frame = CGRectMake(0, 0, 100, 100);
gradientLayer.cornerRadius = 50;
[lookBtn.layer addSublayer:gradientLayer];
[self.view addSubview:lookBtn];
}
图片.png
网友评论