iphone Animation: why does rotating a UILabel around X axis cut off its bottom half?(iphone Animation:为什么围绕 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 Animation:为什么围绕 X 轴旋转 UILabel 会切断它的下半部分?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:iphone Animation:为什么围绕 X 轴旋转 UILabel 会切断它的下半部分?
基础教程推荐
- 为什么姜饼模拟器方向卡在应用程序中? 2022-01-01
- UIImage 在开始时不适合 UIScrollView 2022-01-01
- Xcode UIView.init(frame:) 只能在主线程中使用 2022-01-01
- SwiftUI-ScrollViewReader的ScrollTo不滚动 2022-01-01
- 如何比较两个 NSDate:哪个是最近的? 2022-01-01
- Play 商店的设备兼容性问题 2022-01-01
- navigationItem.backBarButtonItem 不工作?为什么上一个菜单仍然显示为按钮? 2022-01-01
- iOS - UINavigationController 添加多个正确的项目? 2022-01-01
- 如何将图像从一项活动发送到另一项活动? 2022-01-01
- Android Volley - 如何动画图像加载? 2022-01-01
