Skip to content

Latest commit

 

History

History
28 lines (20 loc) · 598 Bytes

README.md

File metadata and controls

28 lines (20 loc) · 598 Bytes

Button-Animation

按钮的渐变色效果

先看效果:

主要代码:

@implementation UIButton (Animation)
/**
 添加渐变色特效
 */
-(void)addGradientButton
{
    CAGradientLayer *layer = [CAGradientLayer layer];
    layer.colors = @[(__bridge id)buleColor.CGColor,(__bridge id)purpleColor.CGColor];
    layer.startPoint = CGPointMake(0, 0);
    layer.endPoint = CGPointMake(1.0, 0);
    layer.frame = self.bounds;
    [self.layer addSublayer:layer];
}