创建一个不断旋转的UIImageView

dev*_*546 0 pi core-animation objective-c rotation

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

- (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];
}
Run Code Online (Sandbox Code Playgroud)

这会旋转我的UIImageView,称为外部,但它没有顺利完成360度旋转im.它以3/4左右的方式跳跃.我不应该在PI上轮换吗?

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

谢谢

dev*_*546 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"];
Run Code Online (Sandbox Code Playgroud)