将三维旋转应用于iPhone视图

将三维旋转应用于iPhone视图,iphone,uiview,3d,rotation,Iphone,Uiview,3d,Rotation,我想在iPhone中的视图(尤其是UILabel)上应用3D旋转。最简单的方法是什么 如需代码示例,将不胜感激。对于二维旋转使用: //rotate label in 45 degrees label.transform = CGAffineTransformMakeRotation( M_PI/4 ); 有关三维变换,请参见: Swft 3示例 let rotationTransform = CATransform3DRotate(myView.layer.transform, CGFloa

我想在iPhone中的视图(尤其是UILabel)上应用3D旋转。最简单的方法是什么

如需代码示例,将不胜感激。

对于二维旋转使用:

//rotate label in 45 degrees
label.transform = CGAffineTransformMakeRotation( M_PI/4 );
有关三维变换,请参见:

Swft 3示例

let rotationTransform = CATransform3DRotate(myView.layer.transform, CGFloat.pi, 1, 0, 0)

UIView.animate(withDuration: 0.5) {
    self.myView.layer.transform = rotationTransform
}

这个问题和你的很相似:谢谢你,布拉德。你认为我应该删除这个吗?
// flipping view along axis
// this will rotate view in 3D along any axis 

[UIView beginAnimations:nil context:nil];
CATransform3D _3Dt = CATransform3DRotate(self.layer.transform, 3.14, 1.0, 0.0,0.0);
[UIView setAnimationRepeatCount:100];
[UIView setAnimationDuration:0.08];
self.layer.transform=_3Dt;
[UIView commitAnimations];
let rotationTransform = CATransform3DRotate(myView.layer.transform, CGFloat.pi, 1, 0, 0)

UIView.animate(withDuration: 0.5) {
    self.myView.layer.transform = rotationTransform
}