// 设置图片渐变效果,遮罩层,半透明
CAGradientLayer *_gradientLayer;
_gradientLayer = [CAGradientLayer layer];
_gradientLayer.borderWidth = 0;
_gradientLayer.frame = CGRectMake(0, 0, kWidth - 5*2, kWidth*0.5 - 2*2);//大小设置成shopImg一样大
_gradientLayer.colors = [NSArray arrayWithObjects:
(id)[[UIColor clearColor] CGColor],
(id)[[UIColor getCommonColorWithColorType:ColorBlackType] CGColor], nil];
_gradientLayer.startPoint = CGPointMake(0.5, 0);//起点:0.5是X,代表正中间,0是Y,代表最上面
_gradientLayer.endPoint = CGPointMake(0.5, 1);
_gradientLayer.opacity = 0.3;//不透明度
[self.shopImg.layer addSublayer:_gradientLayer];