UIImageView do rotation animation
Add rotation animation to layer using CABasicAnimation
forUIView
layer
/// 开始旋转
- (void)showDownloadingImageView {
CABasicAnimation *rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
rotationAnimation.fromValue = [NSNumber numberWithFloat:0.f];
rotationAnimation.toValue = [NSNumber numberWithFloat:M_PI * 2.0];
rotationAnimation.duration = 1;
rotationAnimation.cumulative = YES;
rotationAnimation.repeatCount = NSUIntegerMax;
rotationAnimation.autoreverses = NO;
[self.loadingView.layer addAnimation:rotationAnimation forKey:@"rotationAnimation"];
}
/// 停止旋转
- (void)hideDownloadingImageView {
[self.loadingView.layer removeAllAnimations];
}