オブジェクト (UIImageView) をポイント A からポイント B に移動し、ポイント B で画像を 180 度回転させて反対方向に向け、オブジェクトを B から A (後方) に移動する必要があります。
AからBに移動する以下のコードがあります。UIImageViewを回転させる方法も知っています。しかし、オブジェクトがポイント B に到達したことを知る方法と、画面上に多くのオブジェクトがあることを考慮して回転アクションを適用する方法は?
CAKeyframeAnimation *pathAnimation = [CAKeyframeAnimation animationWithKeyPath:@"position"];
pathAnimation.duration = speed;
pathAnimation.calculationMode = kCAAnimationPaced;
pathAnimation.fillMode = kCAFillModeForwards;
pathAnimation.removedOnCompletion = NO;
CGMutablePathRef pointPath = CGPathCreateMutable();
CGPathMoveToPoint(pointPath, NULL, rect.origin.x, rect.origin.y);
CGPathAddLineToPoint(pointPath, NULL, x, y);
pathAnimation.path = pointPath;
CGPathRelease(pointPath);
[imageView.layer addAnimation:pathAnimation forKey:[NSString stringWithFormat:@"pathAnimation%@",objId]];
[imageView release];