Ios Facebook流行动画只工作一次
每次我的应用程序中出现问题时,我都会使用库来弹出视图。问题是,动画仅在第一次出现时有效 这个片段很容易复制Ios Facebook流行动画只工作一次,ios,facebook-pop,Ios,Facebook Pop,每次我的应用程序中出现问题时,我都会使用库来弹出视图。问题是,动画仅在第一次出现时有效 这个片段很容易复制 - (IBAction)buttonAction:(id)sender { POPSpringAnimation *sprintAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPViewScaleXY]; sprintAnimation.toValue = [NSValue valueWithCGP
- (IBAction)buttonAction:(id)sender
{
POPSpringAnimation *sprintAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPViewScaleXY];
sprintAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(0.9, 0.9)];
sprintAnimation.velocity = [NSValue valueWithCGPoint:CGPointMake(2, 2)];
sprintAnimation.springBounciness = 20.f;
[self.shakeView pop_addAnimation:sprintAnimation forKey:@"springAnimation"];
}
第一次点击按钮时,shakeView
已正确设置动画,但在点击后不会显示动画
在添加新动画之前,我尝试使用[self.shakeView pop\u removeAllAnimations]
删除所有动画,但没有效果
我想我在流行音乐的使用中遗漏了一些东西。好的,我发现了问题。解决方案是将
removedOnCompletion
设置为NO
,如下所示:
- (IBAction)buttonAction:(id)sender
{
POPSpringAnimation *sprintAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPViewScaleXY];
sprintAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(0.9, 0.9)];
sprintAnimation.velocity = [NSValue valueWithCGPoint:CGPointMake(2, 2)];
sprintAnimation.springBounciness = 20.f;
sprintAnimation.removedOnCompletion = NO;
[self.shakeView pop_addAnimation:sprintAnimation forKey:@"springAnimation"];
}