码迷,mamicode.com
首页 > 其他好文 > 详细

360 旋转

时间:2015-12-30 22:08:23      阅读:235      评论:0      收藏:0      [点我收藏+]

标签:

- (void)rotateSpinningView

{

    [UIView animateWithDuration:1.5 delay:0 options:UIViewAnimationOptionCurveLinear animations:^{

        self.imageView.transform = CGAffineTransformRotate(self.imageView.transform, M_PI);

    } completion:^(BOOL finished) {

        [self rotateSpinningView];

    }];

}

 

- (void) runSpinAnimationOnView:(UIView*)view duration:(CGFloat)duration rotations:(CGFloat)rotations repeat:(float)repeat;

{

    CABasicAnimation* rotationAnimation;

    rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];

    rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI * 2.0 /* full rotation*/ * rotations * duration ];

    rotationAnimation.duration = duration;

    rotationAnimation.cumulative = YES;

    rotationAnimation.repeatCount = repeat;

    

    [view.layer addAnimation:rotationAnimation forKey:@"rotationAnimation"];

}

360 旋转

标签:

原文地址:http://www.cnblogs.com/Jenaral/p/5090049.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!