2015-04-29 54 views
0

我試圖旋轉右下角周圍的圖像。圍繞右下邊緣的圖像旋轉iOS

現在它圍繞中心旋轉。

CATransform3D transform = CATransform3DIdentity; 
transform.m34 = 1.0f/-800.0f; // perspective 
transform = CATransform3DRotate(transform, (M_PI * 90), 0.0f, 0.0f, 1.0f); 

if (animation) 
{ 
    [UIView animateWithDuration:0.9 
        animations:^{ 
         [[_sendRecordView layer] setTransform:transform]; 
        } completion:NULL]; 
} 
else 
{ 
    [[_sendRecordView layer] setTransform:transform]; 
} 

回答

0

您需要設置:

[_sendRecordView layer].anchorPoint = CGPointMake(X, Y); 

其中X和Y所需的右下邊緣點。

編輯: 默認情況下,視圖圍繞中心旋轉,因爲anchorPoint位於該位置。

+0

我認爲默認值是0.5,0.5 - 居中。我試過了,視圖向上移動並離開。 – user2565076