2010-11-24 3 views
1

피벗의 UIView (원형 차트 사용)를 회전하는 방법을 알려주시겠습니까? 사용자가보기를 가볍게 치면 일단 회전합니다.피벗의 UIView 회전

답변

4

이 같은 것을 사용하십시오 : 당신이 360도를 회전 할 때

- (void)spin 
{ 
     CABasicAnimation *fullRotation; 
     fullRotation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"]; 
     fullRotation.fromValue = [NSNumber numberWithFloat:0]; 
     fullRotation.toValue = [NSNumber numberWithFloat:M_PI * 360/180.0]; 
     fullRotation.duration = 0.25; 
     fullRotation.repeatCount = 1; 
     [self.view.layer addAnimation:fullRotation forKey:@"360"]; 
} 

단지 스핀 메서드를 호출합니다. 더 많이, 작게, 더 빨리, 더 느리게 등을 돌리기 위해 필요에 따라 조정하십시오.

편집 : 위의 코드에서 view 속성이 명확하지 않은 경우를 대비하여 우리가 회전중인 속성임을 유의하십시오. 따라서 회전하려는보기로 self.view을 변경하십시오.

관련 문제