隨着值的變化,我需要在圓形圖像邊緣移動圖像。我試着將這段代碼作爲示例移動到動畫中,但沒有效果。Objective C-在圓圈中旋轉指針
CGMutablePathRef path=CGPathCreateMutable()
CGPathMoveToPoint(path,NULL,image.frame.origin.x,image.frame.origin.y)
CGPathAddQuadCurveToPoint(path,NULL,image.frame.origin.x,image.frame.origin.y,pointer.frame.origin.x,pointer.frame.origin.y);
CAKeyframeAnimation *circle=[CAKeyframeAnimation animationWithKeyPath:@"circle"];
circle.path=path;
[circle setCalculationMode=kCAAnimationCubic];
[circle setFillMode=kCAFillModeForwards];
[pointer.layer addAnimation:circle forKey:nil];
pointer
(UIImage
)是可移動物體和image
(UIImage
)的背景圖像
您是否嘗試使用'CGAffineTransformMakeRotation'旋轉並更改圖層的錨點? – anhtu