【问题标题】:Flip+Scale Transition like iTunes on iPad像 iPad 上的 iTunes 一样翻转+缩放过渡
【发布时间】:2012-07-02 06:16:12
【问题描述】:

我查看了其他几篇文章,发现一些 UIAnimation 过渡提供了执行 Flip+Scale 过渡的解决方案,就像 iPad 上的 iTunes 应用程序一样。但是,我没有得到完全相同的结果。我试过循环 UIView 动画,但不起作用。

有人能解释一下吗?

【问题讨论】:

    标签: iphone uiview


    【解决方案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];
    
     }
     ];
    

    placeholderView 是将从 16x6 小图像缩放的视图。而 myMainView 是翻转+缩放过渡结束后显示的视图。希望对希望实现此功能的人有所帮助:)

    【讨论】:

      猜你喜欢
      • 2013-10-10
      • 2015-11-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-12-17
      • 1970-01-01
      • 2017-12-01
      • 1970-01-01
      相关资源
      最近更新 更多