-1
Guyz ...我stucked有一個愚蠢的問題...使用UIRotationGestureRecognizer以固定角度(任意方向)旋轉UIView?
我可以用UIRotationGestureRecognizer旋轉,我UIView而只是希望有固定角度旋轉它(爲說45度),在任何方向上考慮的閾值(recognizer.rotation)。
請幫我...在此先感謝....
:)
Guyz ...我stucked有一個愚蠢的問題...使用UIRotationGestureRecognizer以固定角度(任意方向)旋轉UIView?
我可以用UIRotationGestureRecognizer旋轉,我UIView而只是希望有固定角度旋轉它(爲說45度),在任何方向上考慮的閾值(recognizer.rotation)。
請幫我...在此先感謝....
:)
這段代碼對我的作品
-(void)doAction:(UIRotationGestureRecognizer *)recognizer {
if ([recognizer state] == UIGestureRecognizerStateEnded){
float RotationinDegrees = recognizer.rotation * (180/M_PI);
NSLog(@"Rotation %f",RotationinDegrees);
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:.3];
if (RotationinDegrees>thresholdValue) {
self.transform = CGAffineTransformRotate([self transform], DEGREES_TO_RADIANS(desiredangle));
}
[UIView commitAnimations];
[recognizer setRotation:0];
}
}