旋转45°的UIView消失了吗? [英] UIView rotated by 45° disappears?

查看:84
本文介绍了旋转45°的UIView消失了吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

也许我没有得到。当我这样做时

maybe I don't get. When I do

self.tweetPeak.transform = CGAffineTransformMakeRotation(RADIANS(45));

其中RADIAN

#define RADIANS(degrees) ((degrees * M_PI) / 180.0)

在一个简单的UIView对象上,它将消失。

on a simple UIView Object it will disappear.

我想这只是为了看到它。我的印象是视图在20到45度之间变小。

I guess it's just to thin to see. My impression is that the view is getting smaller in a range between 20 to 45 degrees.

这是什么?我试图将视图设置为不透明。没有效果。

What is it? I tried to set the view opaque. No effect.

chris

推荐答案

你需要停止调整旋转后的帧,它会导致对变换矩阵的不期望的拉伸,我不确定正式的原因,但它与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.

这篇关于旋转45°的UIView消失了吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆