2017-09-08 17 views
0

Facebook Popライブラリを使用して、アプリで何か起こるたびにビューをバウンスします。問題はアニメーションが最初のオカレンスでのみ機能することです。Facebookのアニメーションは一度しか動作しません

それはこのスニペット

- (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_removeAllAnimations]を使ってすべてのアニメーションを削除しようとしましたが、うまくいきません。

私はポップの使い方で何かを逃したと思う。

答えて

1

[OK]問題が見つかりました。解決策は、次のようにremovedOnCompletionNOに設定することです。

- (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"]; 
} 
関連する問題