iOS 将 UIView 与 XZ 平面平行对齐
我意识到默认情况下 UIView
与 XY 平面平行,Z 轴直接指向您。
如何旋转此 UIView
使其与 XZ 平面平行?我想我必须使用 CATransform3D 但不确定我应该给它什么角度? M_PI_2 或-M_PI_2 ?
有人有什么想法吗?感谢您的帮助...
编辑:我知道通过这样做,UIView
对用户将不可见,但我想设置一个特定的UIView
这样 &然后在上面做一些旋转动画。所以这就是我想要的..
I realize that by default a UIView
is parallel to the X-Y plane, the Z-axis coming straight at you.
How do I rotate this UIView
so that it is parallel to X-Z plane? I think I have to use CATransform3D
but am not sure what angle I should give it? M_PI_2 or -M_PI_2 ?
Anybody has any idea? Thanks for help...
EDIT: I know that by doing this, the UIView
will not be visible to the user, but I want to set a particular UIView
this way & then do some rotation animation on it. So this is what I want..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能想要做的是将转换应用于视图的支持层。
UIView
上的transform
属性是仿射变换,不允许任何 3D 操作。但是访问 view.layer.transform 您将拥有一个完整的 4x4 矩阵来满足您的转换需求,从而允许漂亮的时髦 3D 内容。QuartzCore.framework
添加到您的目标。
以访问CALayer
API。例如:
WHat you probably want to do is to apply a transformation to the view's backing layer. The
transform
property onUIView
is an affine transformation, not allowing any 3D manipulation. But accessingview.layer.transform
you have a full 4x4 matrix for your transformation needs, allowing nice funky 3d stuff.QuartzCore.framework
to your target.<QuartzCore/QuartzCore.h>
to get access to theCALayer
API.For example: