圖片實現旋轉

---實現圖片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];

}

相關文章
相關標籤/搜索