iphone 动画:为什么围绕 X 轴旋转 UILabel 会切断其下半部分?
我想围绕 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)
I want to rotate a UILabel around the X axis, and animating it. But when the animation starts, the text of the label is cut in two, horizontally. The bottom half disappears, the upper half is rotating. Why?
Here's the code:
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)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
X轴?这意味着在旋转期间 UILabel 的一半将有
z > 0
(在屏幕前面),一半将有z < 0
(屏幕后面)。如果
z == 0
处还有其他图层,它们将覆盖 UILabel 的z
z
0 一半。
尝试增加标签图层的
zPosition
。X axis? That means during the rotation half of the UILabel will have
z > 0
(in front of the screen) and half will havez < 0
(behind the screen).If there's other layers at
z == 0
they will cover your UILabel'sz < 0
half.Try to increase your label's layer's
zPosition
.