Question

- (void)rotateImageView
{
    [UIView animateWithDuration:[self returnTime] delay:0 options:UIViewAnimationOptionCurveLinear animations:^{
        [self.imageView setTransform:CGAffineTransformRotate(self.imageView.transform, M_PI_2)];
    }completion:^(BOOL finished){
        if (finished) {
           if (_player.playing)
                [self rotateImageView];
        }
    }];
}

[self returnTime] can return an integer between 1-60, and my animation executes for that long. My problem is that it executes relatively slowly, especially when the runtime is higher. How can I fix this so that the animation is faster?

Was it helpful?

Solution

The duration: parameter is the inverse of the speed. That is what duration means: to go a fixed distance in a longer time, you have to go slower. So if you don't want to go that slowly, don't use such high duration: values.

By the way, the duration: value does not have to be greater than 1. Try 0.3 or 0.5, for example.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top