2010-12-27 5 views
1

다음과 같은 코드를 사용하여 오른쪽 방향으로 UIView.it rotatres를 회전합니다. 그러나 오른쪽면 대신 아래쪽을 회전시키고 싶습니다. (오른쪽에있는 것처럼), 어떤 도움을 주시겠습니까? Z 축 방향으로)Z 방향 UI 뷰 회전?

UIView *myView = self.view; 
CALayer *layer = myView.layer; 

CATransform3D transform = CATransform3DIdentity; 
transform.m34 = 1.0/-2000; 

CATransform3D rotationAndPerspectiveTransform = CATransform3DIdentity; 
rotationAndPerspectiveTransform.m34 = 1.0/-500; 
rotationAndPerspectiveTransform = CATransform3DRotate(rotationAndPerspectiveTransform, 45.0f * M_PI/180.0f, 0.0f, 1.0f, 0.0f); 
layer.transform = rotationAndPerspectiveTransform; 

답변

4

CATransform3DRotate 기능을 수행 했습니까?

마지막 세 요소는 뷰가 뒤집을 벡터를 정의합니다. 벡터는 y 축과 평행합니다. 대신 수직 축을 중심으로 회전을 시도하십시오.

rotationAndPerspectiveTransform = CATransform3DRotate(
      rotationAndPerspectiveTransform, 
      45.0f * M_PI/180.0f, 
      1.0f, 0.0f, 0.0f); 

축을 오른쪽 "높이"로 설정하려면 고정 점을 변경해야 할 수 있습니다.

관련 문제