iPad:CATransform3DMakeRotation翻转问题:一半视图不可见

问题描述

| 我写了一些代码将imageview旋转90度,然后翻转它。但是,翻转似乎切断了一半的图像。为什么会这样?
UIImageView *tempView = [[UIImageView alloc] initWithFrame:button.frame];
    tempView.image = [UIImage imageNamed:@\"propertyCard.png\"];
    //tempView.backgroundColor = [UIColor redColor];
    tempView.opaque = YES;
    [self.view addSubview:tempView];

    [UIView animateWithDuration: 1
                          delay: 0
                        options: UIViewAnimationoptionBeginFromCurrentState
                     animations:^{

                         // rotate
                         tempView.layer.transform = CATransform3DMakeRotation(M_PI /2,0.,1);                        
                     }
                     completion:^(BOOL finished) {

                         [self showPropertyViews];

                         [UIView animateWithDuration: 1 
                                               delay: 0
                                             options: UIViewAnimationoptionBeginFromCurrentState
                                          animations:^{

                                              // flip
                                              tempView.layer.transform = CATransform3DMakeRotation(M_PI,1.0,0.0);

                                          }
                                          completion:^(BOOL finished) {


                                              [UIView animateWithDuration: 1
                                                                    delay: 0
                                                                  options: UIViewAnimationoptionBeginFromCurrentState
                                                               animations:^{

                                                                  tempView.frame = CGRectMake(propertyView.frame.origin.y + 12,propertyView.frame.origin.x +12,propertyView.frame.size.height-20,propertyView.frame.size.width-20);
                                                                  tempView.center = propertyView.center;
                                                               }
                                                               completion:^(BOOL finished) {

                                                                   tempView.hidden = YES;
                                                                   propertyView.hidden = NO;
                                                                   propertyView.alpha = 1;
                                                                   [self displayCoverFlow];

                                                                   [tempView removeFromSuperview];
                                                                   [tempView release];



                                                               }];
                                              }];

                     }];
    

解决方法

当视图几乎垂直于屏幕旋转时,更远的一半将被视图层次结构中的某些其他视图覆盖。尝试为要设置动画的视图设置一些“足够大”的Z值,例如:
myView.layer.zPosition = 1000.0;
    

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...