本文介绍了触摸时顺时针/逆时针旋转图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于如何在触摸时顺时针/逆时针旋转图像的任何想法.

Any idea about how to spin image clockwise/anticlockwise on touch.

推荐答案

#import <QuartzCore/QuartzCore.h>

[UIView beginAnimations:@"RotationAnimation" context:nil];

CABasicAnimation *fullRotationAnimation;
fullRotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
fullRotationAnimation .fromValue = [NSNumber numberWithFloat:0];
fullRotationAnimation.toValue = [NSNumber numberWithFloat:((360*M_PI)/180)];
fullRotationAnimation.duration = 2;          // speed for the rotation. Smaller number is faster
fullRotationAnimation.repeatCount = 1e100f;  // number of times to spin. 1 = once
[myImage.layer addAnimation:fullRotationAnimation forKey:@"360"];

[UIView commitAnimations];

这篇关于触摸时顺时针/逆时针旋转图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 12:49