iPhone动画: why does rotating a UILabel around X axis cut off its bottom half?

标签 iphone user-interface core-animation rotation

我想围绕 X 轴旋转 UILabel,并为其设置动画。但是当动画开始时,标签的文本会被水平切成两半。下半部分消失,上半部分在旋转。为什么?

代码如下:

CATransform3D _3Dt = CATransform3DMakeRotation(radians(90.0f), 1.0, 0.0, 0.0);

CABasicAnimation *transformAnimation = [CABasicAnimation animationWithKeyPath:@"transform"];

transformAnimation.removedOnCompletion = NO;

transformAnimation.toValue = [NSValue valueWithCATransform3D:_3Dt];

transformAnimation.fillMode = kCAFillModeForwards;

(SDK 3.0)

最佳答案

X 轴?这意味着在旋转期间 UILabel 的一半将有 z > 0 (在屏幕前)一半将有 z < 0 (在屏幕后面)。

如果 z == 0 处还有其他层它们将覆盖您的 UILabel 的 z < 0一半。

尝试增加标签层的 zPosition .

关于iPhone动画: why does rotating a UILabel around X axis cut off its bottom half?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2301067/

相关文章:

javascript - 如何通过 JavaScript 打开 Chosen?

ios - UIDynamicAnimator 摇动 Spring 效果

ios - TestFlight 构建不再与 iPhone 4S 兼容

iphone - 如何将服务器连接到 Xmmp 服务器

iphone - 无需注册即可恢复非续订订阅的交易

c++ - C++ 中的动态 QT4 菜单

iphone - 如何从 SKScene 中执行 segue?

user-interface - Qt mac : How does the layout differs from other OSes

iphone - 如何为 View 的同时旋转和缩放设置动画?

iphone - 带有 subview 的 UIView beginAnimations