私のプログラムは製品のグリッド ビューです。クリックすると、画像が元の位置から目的の目的地 (View Controller 内の位置) にアニメーション化されます。iPad シミュレーターで実行すると、画像は遅延なく即座にアニメーションを開始しますが、デバイス (iPad) で実行すると、アニメーションが開始されるまでに約 1 秒の遅延が発生します。
これが私のコードです。ベジエパスを使用しています。
[UIView animateWithDuration:1.1
animations:^{
UIBezierPath *movePath = [UIBezierPath bezierPath];
[movePath moveToPoint:cellImageView.center];
[movePath addQuadCurveToPoint:self.miniDropHereView.center
controlPoint:CGPointMake(self.miniDropHereView.center.x, cellImageView.center.y)];
CAKeyframeAnimation *moveAnim = [CAKeyframeAnimation animationWithKeyPath:@"position"];
moveAnim.path = movePath.CGPath;
moveAnim.removedOnCompletion = NO;
CABasicAnimation *scaleAnim = [CABasicAnimation animationWithKeyPath:@"transform"];
scaleAnim.fromValue = [NSValue valueWithCATransform3D:CATransform3DIdentity];
scaleAnim.toValue = [NSValue valueWithCATransform3D:CATransform3DMakeScale(0.1, 0.1, 1.0)];
scaleAnim.removedOnCompletion = YES;
CABasicAnimation *opacityAnim = [CABasicAnimation animationWithKeyPath:@"alpha"];
opacityAnim.fromValue = [NSNumber numberWithFloat:1.0];
opacityAnim.toValue = [NSNumber numberWithFloat:0.1];
opacityAnim.removedOnCompletion = YES;
CAAnimationGroup *animGroup = [CAAnimationGroup animation];
animGroup.animations = [NSArray arrayWithObjects:moveAnim, scaleAnim, opacityAnim, nil];
animGroup.duration = 1;
[cellImageView.layer addAnimation:animGroup forKey:@"angelica"];
cellImageView.alpha = 0; //.0000000000000000000001;
self.animateProduct = animGroup;
self.cellImageViewGlobal = cellImageView;
self.animateProduct.delegate= self;
}
completion:^(BOOL finished){
cellImageView.alpha = 0.0000000000000000000001;
[cellImageView removeFromSuperview];
}];
}
アニメーションが始まる前の遅延を操作する方法を研究しました。そこで、アニメーション コードの最初の行を変更します (以下に指定)。
[UIView animateWithDuration:1.1 delay: 0.0f
options: UIViewAnimationOptionCurveEaseInOut
animations:^{
しかし、遅延を指定していなくても、製品をクリックするとすぐにアニメーションが開始されます (iPad シミュレーターを使用している場合)。iPad に問題があるかどうかはわかりません。アニメーションの開始をスピードアップする他の方法はありますか?
ありがとう。