2014-12-06 214 views
0

我使用CATransform3DMakeRotation使用下面的代碼旋轉沿x軸一個UIView目標C CATransform3DMakeRotation順時針/逆時針

float radians = DegreesToRadians(30); 
    [UIView animateWithDuration:0.15 animations:^{ 
     self.moveControlView.layer.transform = CATransform3DMakeRotation(radians,1,0,0); 
    }]; 

的旋轉在相同的總應用於與(順時針) 。我想旋轉UIView與之相反。 爲了實現我的目標我已經試過:

  • 設置一個負角度(-30)
  • 設置角度爲330

但與方向不改變。

我也嘗試設置x = -1使角度保持正值。

有什麼建議嗎?

回答

1

你應該申請一個角度來您的轉換,因爲它解釋in the similar question

CATransform3D perspectiveTransform = CATransform3DIdentity; 
perspectiveTransform.m34 = 1.0/-500; 

self.moveControlView.layer.transform = 
CATransform3DRotate(perspectiveTransform, radians, 1.0f, 0.0f, 0.0f);; 
+0

感謝已經解決了(就像你寫的):-) – 2014-12-12 14:42:42

相關問題