Rotate UIImageView clockwise

后端 未结 4 1784
再見小時候
再見小時候 2021-02-03 11:48

This should be simple, but I\'m having trouble rotating a UIImageView a full 360 degrees, repeated forever.

[UIView animateWithDuration:0.5 delay:0          


        
4条回答
  •  鱼传尺愫
    2021-02-03 12:32

    Sorry missed first part, view rotates just fine using smaller angle:

    [UIView animateWithDuration:0.5 delay:0 options:UIViewAnimationOptionAllowUserInteraction | UIViewAnimationOptionRepeat | UIViewAnimationOptionCurveLinear | UIViewAnimationOptionBeginFromCurrentState animations:^{
            redView.transform = CGAffineTransformRotate(redView.transform, M_PI_2);
        } completion:^(BOOL finished) {
    
        }];
    

    I couldn't find any meaningful explanations why it fails with M_PI.

提交回复
热议问题