添加渐变色
原创
©著作权归作者所有:来自51CTO博客作者拔山河的原创作品,请联系作者获取转载授权,否则将追究法律责任
- (UIImageView)smallBackgroundImageView {
if(!_smallBackgroundImageView)
{
_smallBackgroundImageView = [[UIImageView alloc] initWithFrame:CGRectMake(12,FULL_WIDTH207/375+5+147.5+10, FULL_WIDTH-12*2, (FULL_WIDTH-24)*90/351)];
[_smallBackgroundImageView addCornerWithCornerRadius:20.0/2];
_smallBackgroundImageView.backgroundColor = [UIColor clearColor];
CAGradientLayer *gradientLayer = [CAGradientLayer layer];
gradientLayer.colors = @[(__bridge id)((BGColorHex(F7391F)).CGColor), (__bridge id)((BGColorHex(FE6B56)).CGColor)];
gradientLayer.startPoint = CGPointMake(0.5, 0);
gradientLayer.endPoint = CGPointMake(0.5, 1);
gradientLayer.frame = CGRectMake(0, 0, FULL_WIDTH-12*2, (FULL_WIDTH-24)*90/351);
[_smallBackgroundImageView.layer addSublayer:gradientLayer];
}
return _smallBackgroundImageView;
}