图像围绕右下边缘旋转 iOS
Image rotation around the lower right edge 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];
}
您需要这样设置:
[_sendRecordView layer].anchorPoint = CGPointMake(X, Y);
其中 X 和 Y 是所需的右下边缘点。
编辑:
默认情况下,视图围绕中心旋转,因为锚点位于该位置。
我正在尝试围绕右下边缘旋转图像。
现在它围绕中心旋转。
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];
}
您需要这样设置:
[_sendRecordView layer].anchorPoint = CGPointMake(X, Y);
其中 X 和 Y 是所需的右下边缘点。
编辑: 默认情况下,视图围绕中心旋转,因为锚点位于该位置。