且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

旋转45°的UIView消失了吗?

更新时间:2023-02-02 15:21:21

你需要停止调整旋转后的帧,它会导致对变换矩阵的不期望的拉伸,我不确定正式的原因,但它与Apple使用他们自己的矩阵系统而不是传统的矩阵来表示2D / 3D平移/旋转/规模。前几天我遇到了同样的问题,为了修复它,而不是旋转那个视图,我只是把它变成了一个容器,里面有我希望旋转的实际视图,然后旋转它。

You need to stop adjusting the frame after the rotation, it causes undesired stretching to the transform matrix, I'm unsure to the formal reason why, but it has something to do with Apple using their own matrix system rather than traditional matrices to represent 2D/3D translations/rotations/scale. I was having the same problem the other day, to fix it, instead of rotating that view, I just made it a container with the actual view I wanted rotated inside, and rotated that.