CAGradientLayer *gl = [CAGradientLayer layer];
gl.frame = CGRectMake(0,0,100,24);
gl.startPoint = CGPointMake(0, 0);
gl.endPoint = CGPointMake(1, 1);
gl.colors = @[(__bridge id)[UIColor colorWithRed:0/255.0 green:168/255.0 blue:79/255.0 alpha:1.0].CGColor,(__bridge id)[UIColor colorWithRed:26/255.0 green:186/255.0 blue:74/255.0 alpha:1.0].CGColor];
gl.locations = @[@(0.0),@(1.0f)];
[_continueStudyBtn.layer addSublayer:gl];
1.解决方法。背景放在最底层
[_continueStudyBtn.layer insertSublayer:gl atIndex:0];
[_continueStudyBtn bringSubviewToFront:_continueStudyBtn.imageView];