0

我试过使用这样的核心动画:

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.

    [UIView animateWithDuration:2.0 delay:0.0 options:UIViewAnimationOptionRepeat | UIViewAnimationOptionCurveLinear animations:^{ CGAffineTransform transform = CGAffineTransformMakeRotation(3.14);
        self->inner.transform = transform;
    } completion:NULL];
}

这会旋转我的 UIImageView,称为外部,但它不会顺利完成 360 度旋转。它在它的 3/4 左右之后跳跃。我不应该在 PI 上轮换吗?

如果我想改变旋转的方向,我该怎么做?它在一分钟内顺时针旋转。

谢谢

4

1 回答 1

7

如果其他人在任何时候都需要这个:

//outer ring
CABasicAnimation *fullRotationAnimation;
fullRotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
fullRotationAnimation.fromValue = [NSNumber numberWithFloat:0.0f];
fullRotationAnimation.toValue = [NSNumber numberWithFloat:2 * M_PI];
fullRotationAnimation.duration = 4;
fullRotationAnimation.repeatCount = 5000;
//fullRotationAnimation.cumulative = YES;
[self->outer.layer addAnimation:fullRotationAnimation forKey:@"360"];
于 2012-08-13T16:59:20.430 回答