如何实现iPhone默认电话应用程序的手机通话动画呢?

时间:2013-02-13 07:29:19

标签: iphone animation

我的应用程序有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];

}

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

2 个答案:

答案 0 :(得分:0)

如果我试图创建动画,我可能会尝试这些。

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%说出他们是如何做到的,但是如果我要尝试重新创建它,我可能会从这里开始。

  • 答案 1 :(得分:0)

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

    ` - (无效)的动画{

    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。它仍然可能,但这是一个非常方便的内置功能。但是你可以与屏幕互动的事实让我想到了一个自定义视图。在我看来这会更容易。

    我希望这对你有所帮助,即使它只是一点点。 小心^^