2015-04-29 60 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