iOS开发之基本旋转动画

时间:2020-04-27 17:25:46   收藏:0   阅读:58

今天碰到个需要将图片一直旋转的需求,话不多说直接上代码

    CABasicAnimation *rotationAnimation;
    rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
    rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI * 2.0 ];
    rotationAnimation.duration = 1;
    rotationAnimation.cumulative = YES;
    rotationAnimation.repeatCount = 10000;
    [_sendLoadingImageView.layer addAnimation:rotationAnimation forKey:@"rotationAnimation"];

移除动画

[_sendLoadingImageView.layer removeAllAnimations];

 

原文:https://www.cnblogs.com/hecanlin/p/12788045.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!