1

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., 0, 1);                        
                     }
                     completion:^(BOOL finished) {

                         [self showPropertyViews];

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

                                              // flip
                                              tempView.layer.transform = CATransform3DMakeRotation(M_PI, 1.0,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];



                                                               }];
                                              }];

                     }];
4

1 に答える 1

8

ビューが画面に対してほぼ垂直になると、より離れた半分がビュー階層内の他のビューによってカバーされます。アニメーション化されるビューに「十分に大きな」Z 値を設定してみてください。たとえば、次のようになります。

myView.layer.zPosition = 1000.0;
于 2012-10-16T15:52:56.077 に答える