Blu*_*pud 5 core-animation clipping uiview ios
所以我想在看似3D的东西中旋转我的UIView.我做了一个快速搜索,互联网上说:使用核心动画.所以我看了一眼,然后我想出了这个代码,让我的视图旋转
CABasicAnimation* animation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.x"];
animation.fromValue = @(0);
animation.toValue = @(4 * M_PI);
animation.repeatCount = INFINITY;
animation.duration = 5.0;
[self.layer addAnimation:animation forKey:@"rotation"];
CATransform3D transform = CATransform3DIdentity;
transform.m34 = 1.0 / -2000;
self.layer.transform = transform;
self.layer.masksToBounds = NO;
Run Code Online (Sandbox Code Playgroud)
实际视图旋转正常,但它会切断视图的一半.这是我在photoshop中制作的快速图片,以显示我的意思
我现在已经进行了数小时的搜索,而且我似乎无法弄清楚是什么引起了这种情况.任何帮助或输入将不胜感激.谢谢.
编辑:继承人我是如何创建视图的:
UIView* test = [[UIView alloc] initWithFrame:CGRectMake(200, 200, 100, 100)];
test.backgroundColor = [UIColor redColor];
[self.view addSubview:test];
Run Code Online (Sandbox Code Playgroud)
在界面生成器中创建的视图上尝试后,它工作正常,但我需要以编程方式进行这些操作.
| 归档时间: |
|
| 查看次数: |
688 次 |
| 最近记录: |