Leo*_*rey 11 xcode core-animation interface-builder ios catransform3drotate
使用带有CATransform3DMakeRotation的以下UIView动画,UIView的一半将在变换期间消失并在完成时重新出现.这只发生在界面构建器的视图层次结构中UIView后面的UIImageView时.
[UIView animateWithDuration:1.0 delay:0.0 options:nil animations:^{
myView.layer.transform = CATransform3DMakeRotation(M_PI,0.0,1.0,0.0);
} completion:nil];
Run Code Online (Sandbox Code Playgroud)
以下是界面构建器中的视图布局
以及下面的动画结果.
第二张图像是在任何动画发生之前,左半部分消失.收缩后,经过中心点后,右侧(前一个左侧)重新出现,如第四张图所示.
使用时设置背景图像
self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"jeans.png"]];
Run Code Online (Sandbox Code Playgroud)
动画按预期完成.
joe*_*ick 28
为了记录,答案在我的评论中
imageView.layer.zPosition = -400;
Run Code Online (Sandbox Code Playgroud)
或者你可以做到
myView.layer.zPosition = 400; // or some number greater than width/2
Run Code Online (Sandbox Code Playgroud)
看起来旋转视图的一部分被背景视图遮挡.由于它围绕其中心点旋转,因此它的一部分进入负z空间,因此在背景后面.
所以来自
------- imageView
------- myView
Run Code Online (Sandbox Code Playgroud)
至
/ myView
/
------- imageView
/
/
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
1689 次 |
最近记录: |