【问题标题】:How to impelment Phone call animation like iPhone's default Phone application does?如何像 iPhone 的默认电话应用程序那样实现电话动画?
【发布时间】:2013-02-16 10:01:38
【问题描述】:

我的应用程序有 VOIP 呼叫。在这一点上,我想实现像 iPhone 的默认电话应用程序在用户单击拨号盘上的呼叫按钮时所做的动画以及在结束呼叫按钮上完成的动画。

我对此进行了很多研究,但还没有找到任何东西。对此主题的任何帮助将不胜感激。

现在我已经实现了如下缩放动画:

- (void)animateFadingOut{

    self.view.transform = CGAffineTransformMakeScale(1.00, 1.00);
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:0.5];
    [UIView setAnimationDelegate:self];

    [self performSelector:@selector(push) withObject:nil afterDelay:0.35];
    self.view.transform = CGAffineTransformMakeScale(0.00, 0.00);
    //set transformation
    [UIView commitAnimations];


}

- (void)push
{
    self.view.transform = CGAffineTransformMakeScale(1.00, 1.00);
    // push navigation controloller
    CallViewController *objCallViewController = [[CallViewController alloc] initWithNibName:@"CallViewController_iPhone" bundle:nil];
    [self setHidesBottomBarWhenPushed:YES];

    [self.navigationController pushViewController:objCallViewController animated:NO];
    [objCallViewController release];
    [self setHidesBottomBarWhenPushed:NO];
    [[AppDelegate shared] setTabHidden:TRUE];

}

但它并没有给我默认电话应用程序具有的确切动画

【问题讨论】:

  • 请您附上一些代码或其他任何东西?

标签: iphone animation


【解决方案1】:

如果我尝试创建动画,我可能会尝试以下方法。

CGRect movementFrame = self.view.frame;
//Make position and size changes as needed to frame
movementFrame.origin.x = 0;

[UIView animateWithDuration:0.5
                      delay:0.0
                    options:UIViewAnimationOptionCurveEaseOut
                 animations:^{

                     /*
                       Animation you want to commit go here
                       Apply movementFrame info to the frame
                       of the item we want to animate
                     */

                     //If you wanted a fade
                     self.view.alpha = !self.view.alpha //Simply says I want the reverse.

                     self.view.frame = movementFrame;

                     //Example of what you could do.

                     self.view.transform =CGAffineTransformMakeScale(1.00, 1.00);

                 } completion:^(BOOL finished) {
                     //Things that could happen once the animation is finished
                     [self push];
                 }];

这尚未针对您的情况进行测试。因此,我也不确定它是否会帮助你,但希望它会。祝你好运。

*编辑*

所以我在 iPhone 上查看了动画,在我看来它是同时发生的一系列动画。

  • 你有我认为的 UIActionSheet 动画。
  • 顶部覆盖层在其 y 轴上滑动。
  • 然后你有,我还没有掌握,后视图中的一个拆分,它在相反的方向上动画它的 x 轴,导致拆分。
  • 最后,您可以放大新视图以获取效果的框架。

    我不能说 100% 他们是如何做到的,但是如果我要尝试重新创建它,我可能会从这里开始。

  • 【讨论】:

    • 你的代码和我的一样。我没有得到像默认电话应用程序那样的精确动画。你能告诉我默认电话应用程序有哪种类型的动画吗?
    • 感谢您的回复,我已经尝试了您的步骤,但仍然没有得到它。
    • 我会看看我是否可以重新创建它并告诉你我做了什么。
    【解决方案2】:

    你好,所以在我快速制作动画后,我已经非常接近它可以使用一些调整。 我花了三个视图来做一个 topView, bottomView, and backView. 还考虑了您将要加载的视图。viewToLoadIn

    `-(void)动画{

    CGRect topMovementFrame = self.topView.frame; //Set dummy frame to modify 
    CGRect bottomViewFrame = self.bottomview.frame;
    topMovementFrame.origin.y = 0 - self.topView.frame.size.height; //modify frame's yAxis so that the frame sits above the screen.
    bottomViewFrame.origin.y = self.view.frame.size.height; //modify frame's yAxis to the it will sit at the bottom of the screen.
    
    [self.viewToLoadIn setFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
    
    
    [UIView animateWithDuration:0.5
                          delay:0.0
                        options:UIViewAnimationOptionCurveEaseOut
                     animations:^{
                         //Animation
                         self.topView.frame = topMovementFrame; //Commit animations
                         self.bottomview.frame = bottomViewFrame;
                         self.backView.alpha = !self.backView.alpha;
                         self.backView.transform = CGAffineTransformMakeScale(100, 100);
                         self.viewToLoadIn.transform = CGAffineTransformMakeScale(2.0, 3.0);
    
    
                          *MAGIC*
                     } completion:^(BOOL finished) {
                         //Completion
                         //Clean up your views that you are done with here.
                     }];
    

    }`

    所以当他们按下我设置的按钮时,这个动画就会发生。

    起初我还认为设置可能包含UIActionStyleSheet。它仍然可能,但这是一个非常方便的内置功能。但是您可以与屏幕交互的事实让我想到了自定义视图。我认为这会更容易。

    我希望这对您有所帮助,即使只是一点点。 保重^^

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多