图片实现旋转

---实现图片3D立体旋转orm

-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{图片

    CABasicAnimation* rotationAnimation;animation

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

    rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI * 2.0 ];io

    rotationAnimation.duration = 1;event

    rotationAnimation.cumulative = YES;form

    rotationAnimation.repeatCount = MAXFLOAT;transform

    

    [imageView.layer addAnimation:rotationAnimation forKey:@"rotationAnimation"];select

   }im

 

---图片旋转

-(void) startAnimation

{

    [UIView beginAnimations:nil context:nil];

    [UIView setAnimationDuration:0.01];

    [UIView setAnimationDelegate:self];

    [UIView setAnimationDidStopSelector:@selector(endAnimation)];

    imageView.transform = CGAffineTransformMakeRotation(angle * (M_PI / 180.0f));

    [UIView commitAnimations];

}

 

-(void)endAnimation{

    angle += 10;

    [self startAnimation];

}

相关文章
相关标签/搜索