0
我使用動畫的POP
框架。我想挖掘一個UIButton
並讓它增長5%,然後縮小回原來的大小。我可以讓增長或縮減工作,但由於我沒有使用框架,我不知道如何使兩者都發生在一個行動。UIView動畫與POP框架在同一動作中增長和縮小
動畫代碼如下。我從連接到各種按鈕的IBAction
發送此代碼。以下代碼只是讓它增長。
-(void)popAnimationGrowAndShrink:(UIButton*)sender{
const CGRect originalSize = sender.frame;
POPSpringAnimation *animGrow = [POPSpringAnimation animationWithPropertyNamed:kPOPLayerBounds];
POPSpringAnimation *animShrink = [POPSpringAnimation animationWithPropertyNamed:kPOPLayerBounds];
animGrow.toValue = [NSValue valueWithCGRect:CGRectMake(0, 0, sender.frame.size.width * 1.1, sender.frame.size.height *1.1)];
animShrink.toValue = [NSValue valueWithCGRect:originalSize];
animGrow.springSpeed = 5;
animGrow.springBounciness = 10;
animShrink.springSpeed = 5;
animShrink.springBounciness = 10;
[sender.layer pop_addAnimation:animGrow forKey:@"grow"];
[sender.layer pop_addAnimation:animShrink forKey:@"shrink"];
}