iOS pop动画之弹性动画的基本使用

- (void)viewDidLoad

{

    [super viewDidLoad];

    [self initButton];

}

- (void)initButton

{

    UIButton *button = [[UIButton alloc]init];

    button.backgroundColor = [UIColor purpleColor];

    button.bounds = CGRectMake(0, 0, 100, 50);

    button.center = self.view.center;

    button.layer.cornerRadius = 5.f;

    [button addTarget:self action:@selector(clickedBtn:) forControlEvents:UIControlEventTouchUpInside];

    [self.view addSubview:button];

    self.button = button;

}

- (void)clickedBtn:(UIButton *)button

{

    POPSpringAnimation *spring = [POPSpringAnimation animationWithPropertyNamed:kPOPLayerScaleXY];

    spring.velocity = [NSValue valueWithCGSize:CGSizeMake(10.f, 10.f)];

    spring.toValue = [NSValue valueWithCGSize:CGSizeMake(1.f, 1.f)];

    spring.springBounciness = 18.f;

    [self.button.layer pop_addAnimation:spring forKey:nil];

}

原文地址:https://www.cnblogs.com/oumygade/p/4462198.html