Ios 对象自身周围的坐标变换(360度)

Ios 对象自身周围的坐标变换(360度),ios,objective-c,animation,rotation,cabasicanimation,Ios,Objective C,Animation,Rotation,Cabasicanimation,以下是我的动画代码: CABasicAnimation *fullRotation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"]; fullRotation.toValue = [NSNumber numberWithFloat:((360*M_PI)/180)]; fullRotation.duration = 4; fullRotation.repeatCount= 1000;

以下是我的动画代码:

  CABasicAnimation *fullRotation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
    fullRotation.toValue = [NSNumber numberWithFloat:((360*M_PI)/180)];
    fullRotation.duration = 4;
    fullRotation.repeatCount= 1000;
    [[stick layer] addAnimation:fullRotation forKey:@"60"];

      fullRotation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];

我试着绕着它自己旋转“棍子”,但它似乎在绕着另一个点旋转,默认情况下这是原点。我该怎么做才能使它围绕自身完成360度旋转?提前感谢。

如果您想更改斗杆的固定点,请使用:

stick.layer.anchorPoint = CGPointMake(1.0,1.0);

我使用的旋转代码:

CABasicAnimation *rotateAnim = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
    rotateAnim.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
    rotateAnim.fromValue = [NSNumber numberWithFloat:0];
    rotateAnim.toValue = [NSNumber numberWithFloat:(360 * M_PI / 180.0f)];
    rotateAnim.repeatCount = HUGE_VALF;
    rotateAnim.duration = 2.5;
    rotateAnim.removedOnCompletion = NO;

    [view.layer addAnimation:rotateAnim forKey:@"rotationAnimation"];

“此属性的默认值为(0.5,0.5)”,因此基本上,如果对象不围绕其中心旋转,这意味着设计中存在缺陷,对吗?因此,如果我希望围绕中心正确旋转,我应该设计对象,使其真正的中心位于画布的中心,在xcode中,我应该放置一个与对象设计的画布尺寸完全相同的imageview。对吗?是的,默认情况下它应该围绕中心旋转,这就是你想要的吗?@Joseph对,这就是我们过去必须做的。谢谢,现在我明白了。