2011-10-01 49 views
0

我已经做了很多尝试,以获得与拨打电话号码时看到的效果相同的效果:正面视图会放大缩小效果,而另一个也会出现缩放效果。动画两个视图,如当你通过电话拨打

我无法做到这一点,它总是马马虎虎。似乎有一个规模效应,对不透明度的行动,但...

你知道如何做到这一点反映出这种效果(不是那么回事,我有吨)?

回答

-1
// Make this interesting. 

[UIView beginAnimations:nil context:nil]; 
[UIView setAnimationDuration:2.0]; 
[UIView setAnimationTransition:UIViewAnimationTransitionNone forView:self.view cache:YES]; 
[UIView setAnimationDelegate:self]; 
[UIView setAnimationDidStopSelector:@selector(startupAnimationDone:finished:context:)]; 
self.view.alpha = 0.0; 
self.view.frame = CGRectMake(self.view.center.x,self.view.center.y , 0, 0); 
[UIView commitAnimations]; 
} 

我希望这是一个更好的动画框架。它不能保证能够工作,但这是我在转换的第一部分所能想到的最好的。

这将改变视图控制器视图的框架,使其“吸”到屏幕的中心,这是一种天然的黑色。现在我想到了,一个CGAffineTransform会容易得多...

编辑(为了学习的目的):从iOS 4开始,您现在可以使用更新的语法更清晰的动画块和不错的变换:

[UIView animateWithDuration:0.25 delay:0.0 options:0 animations:^{ 
    //animate the toolbars in from the top and bottom 
    [myTopView setFrame:CGRectMake(0, self.view.frame.size.height - 44, self.view.frame.size.width, 44)]; 
    [myBottomView setFrame:CGRectMake(0, 0, self.view.frame.size.width, 44)]; 
    //fade to black... 
    self.view.alpha = 0.0; 
    //and suck inwards. 
    self.view.frame = CGRectMake(self.view.center.x,self.view.center.y , 0, 0); 
} 
completion:^{ 
    //do something to end nicely, or start another animation block. 
}]; 
+0

为什么我既是最佳答案又是被拒绝的人? – CodaFi

+0

可能是因为答案有效,但它不能很好地解释...... –

+0

噢,减仓,蒙弗里。我小时候就发布了这个。我会立即编辑它。 – CodaFi