CAKeyframeAnimation でこの問題が発生しています。UIView のレイヤーをアニメーション化した後、UIView をアニメーション化する位置に配置して、ユーザーがこの UIView のボタンを引き続き使用できるようにします。
私は現在このコードを使用しています:
// Open animation
CAKeyframeAnimation *openAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform.translation.y"];
openAnimation.fillMode = kCAFillModeForwards;
openAnimation.duration = .55;
openAnimation.delegate = self;
openAnimation.removedOnCompletion = NO;
openAnimation.values = [NSArray arrayWithObjects:
[NSNumber numberWithFloat:0.0],
[NSNumber numberWithFloat:58.0],
[NSNumber numberWithFloat:48.0], nil];
openAnimation.keyTimes = [NSArray arrayWithObjects:
[NSNumber numberWithFloat:0.0],
[NSNumber numberWithFloat:0.62],
[NSNumber numberWithFloat:1.0], nil];
openAnimation.timingFunctions = [NSArray arrayWithObjects:
[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut],
[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut], nil];
[locationView.layer addAnimation:openAnimation forKey:@"OPEN_ANIMATION"];
そしてデリゲートメソッド:
- (void)animationDidStop:(CAKeyframeAnimation *)anim finished:(BOOL)flag
{
locationView.y = -10.0;
}
これは実際には機能しますが、最後に、アニメーションが削除され (UIView レイヤーが元の位置にジャンプして戻る)、デリゲート メソッドを即座に呼び出して終了位置にジャンプするという表示上の不具合が発生しています。
最後の手順は次のように感じます: アニメーションが完了し、アニメーションの最後のフレームをレンダリングし、元の位置に戻り、このフレームをレンダリングし、デリゲート メソッドを呼び出し、uiview を終了位置に配置します。
この表示の不具合を修正するにはどうすればよいですか?