UIButton * button = [UIButton buttonWithType:UIButtonTypeCustom];
button.frame = CGRectMake(100, 100, 100, 100);
[self.view addSubview:button];
CAGradientLayer * layar = [CAGradientLayer new];
layar.colors = @[(__bridge id)[UIColor whiteColor].CGColor ,(__bridge id)[UIColor yellowColor].CGColor];
layar.startPoint = CGPointMake(0, 0);
layar.endPoint = CGPointMake(0, 1);
layar.frame = button.frame;
[button.layer addSublayer:layar];

QQ20170406-164153@2x.png