将以下 UIView 动画与 CATransform3DMakeRotation 一起使用,一半的 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];
以下是界面生成器中的视图布局
以及下面的动画结果。
第二张图片是在任何动画发生之前,左半边消失了。在它缩小然后增长超过中心点后,右侧(之前的左侧)重新出现,如第 4 幅图所示。
当使用设置背景图像时
self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"jeans.png"]];
动画按预期完成。