2011-07-26 14 views
-1

まいらは...私は...愚かな問題でstuckedだUIRotationGestureRecognizerを使用して固定(任意の方向)角度でUIViewを回転しますか?

私はUIRotationGestureRecognizerを使用して、私のUIViewを回転させるだけでなく、しきい値を考慮し、任意の方向に(45度と言うために)一定の角度でそれを回転させるようにしたいことができます値(レコグナイザ。回転)。

.... ...

を事前に感謝し、私を助けてください:)

答えて

0

このコードスニペットは私

-(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]; 
}  

}

のために働きます
関連する問題