Ios 如何围绕另一个UIImage的边界设置UIImage的动画

Ios 如何围绕另一个UIImage的边界设置UIImage的动画,ios,objective-c,uiimage,core-animation,image-rotation,Ios,Objective C,Uiimage,Core Animation,Image Rotation,我有两张照片。1个外部图像和1个内部图像。我试图让外部图像围绕内部图像的边界旋转。我对下面显示的代码很熟悉,但我无法让外部图像围绕内部图像完美旋转 CAKeyframeAnimation *pathAnimation = [CAKeyframeAnimation animationWithKeyPath:@"position"]; pathAnimation.calculationMode = kCAAnimationPaced; pathAnimation.fillMode

我有两张照片。1个外部图像和1个内部图像。我试图让外部图像围绕内部图像的边界旋转。我对下面显示的代码很熟悉,但我无法让外部图像围绕内部图像完美旋转

CAKeyframeAnimation *pathAnimation = [CAKeyframeAnimation animationWithKeyPath:@"position"];

    pathAnimation.calculationMode = kCAAnimationPaced;

    pathAnimation.fillMode = kCAFillModeForwards;
    pathAnimation.removedOnCompletion = NO;
    pathAnimation.duration = 5.0;


    pathAnimation.repeatCount = 10;


    CGMutablePathRef curvedPath = CGPathCreateMutable();
    CGPathMoveToPoint(curvedPath, NULL, 10, 10);


    CGRect rectangle = CGRectMake(self.view.frame.origin.x/2,self.view.frame.origin.y/2,200,200);

    CGPathAddEllipseInRect(curvedPath, NULL, rectangle);


    pathAnimation.path = curvedPath;
    CGPathRelease(curvedPath);



    [self.head.layer addAnimation:pathAnimation forKey:@"moveTheObject"];
谢谢你的帮助


编辑**内部图像是围绕180 x 180 px的圆圈,外部图像是正方形。大约50 x 50 px。

为什么不能将图像的中心对齐,然后旋转外部图像?可能缺少点内部图像是围绕180 x 180 px的圆,外部图像是正方形。大约50 x 50像素。那就不行了!它们不是叠加的,它正在扭转它!为什么不在外部图像的侧面添加180/2倍的透明空间,然后旋转。好的,谢谢,我会试试的