iphone动画:为什么围绕X轴旋转UILabel会切断它的下半部分? [英] iphone Animation: why does rotating a UILabel around X axis cut off its bottom half?

查看:90
本文介绍了iphone动画:为什么围绕X轴旋转UILabel会切断它的下半部分?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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?

这是代码:

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 (在屏幕后面)。

X axis? That means during the rotation half of the UILabel will have z > 0 (in front of the screen) and half will have z < 0 (behind the screen).

如果在 z == 0 他们将覆盖你的UILabel的 z< 0 一半。

If there's other layers at z == 0 they will cover your UILabel's z < 0 half.

尝试增加标签的图层 zPosition

这篇关于iphone动画:为什么围绕X轴旋转UILabel会切断它的下半部分?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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