像iPad上的iTunes一样翻转+缩放过渡

时间:2012-07-02 06:16:12

标签: iphone uiview

我已经检查了一些其他帖子并发现了一些UIAnimation转换,这种解决方案可以像在iPad上的iTunes应用程序一样进行Flip + Scale转换。但是,我没有得到完全相同的结果。我试过循环UIView动画但不起作用。

有人可以对此有所了解吗?

1 个答案:

答案 0 :(得分:1)

所以我一直致力于此,我终于找到了解决方案:)

[UIView animateWithDuration:0.4 delay:0 options:UIViewAnimationOptionBeginFromCurrentState animations:
 ^{
     rect = placeHolderView.frame;

     rect.origin.x += 100;
     rect.origin.y += 70;

     [UIView beginAnimations:nil context:NULL];
     [UIView setAnimationDuration:0.5];
      placeHolderView.frame = rect;
     [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:placeHolderView cache:YES];
     [UIView setAnimationDuration:0.5];
     CGAffineTransform transform = CGAffineTransformMakeScale(3.0, 3.0);
     placeHolderView.transform = transform;

     [UIView commitAnimations];

     self.view.layer.cornerRadius = 5.0f;
     self.view.clipsToBounds = YES;

 } completion:^(BOOL finished) {

         [UIView setAnimationBeginsFromCurrentState:YES];
         [UIView transitionWithView:placeHolderView duration:0.8 options:UIViewAnimationOptionTransitionFlipFromRight|UIViewAnimationOptionBeginFromCurrentState animations:
          ^{
              CGAffineTransform transform = CGAffineTransformMakeScale(10.0, 10.0);
              placeHolderView.transform = transform;
              [UIView beginAnimations:nil context:NULL];
              [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:self.purchaseItemView cache:YES];
              [placeHolderView setAlpha:0.0];
              [self.myMainView setAlpha:1.0];
              [UIView setAnimationDuration:0.8];
              [UIView commitAnimations];



          } completion:nil];

 }
 ];

占位符视图是将从小型16x6图像缩放的视图。而myMainView是翻转+比例转换结束后显示的视图。希望能帮助任何想要实现此目的的人:)