开发者

iphone Animation: why does rotating a UILabel around X axis cut off its bottom half?

开发者 https://www.devze.com 2022-12-20 14:41 出处:网络
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

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)


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).

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

Try to increase your label's layer's zPosition.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号