2011-09-19 89 views
0

当我beginAnimation-commitAnimatin块,我得到一个弹跳效果之内写我的动画代码,但是我不,当我做同样的动画获得同样的效果用写在主题中的方法。这里有两种方法可以做我想做的:与animateWithDuration无弹跳效果:延迟:选项:动画:完成:方法

[UIView beginAnimations:nil context:nil]; 
[UIView setAnimationDelay:0.5]; 
[UIView setAnimationDuration:1]; 
[UIView setAnimationCurve:UIViewAnimationCurveEaseIn]; 

[UIView setAnimationRepeatAutoreverses:YES]; 
[UIView setAnimationRepeatCount:2]; 
[UIView setAnimationDelegate:self]; 
[UIView setAnimationDidStopSelector: 
@selector(resetTheChickenProperties)]; 

theChicken.frame = CGRectMake(15, 330, 62, 90); 
[UIView commitAnimations]; 

图像(这是一个鸡蛋),上面显示的方式去y方向,直到它击中地面和反弹。弹跳效果清晰可见。但是,如果我做同样的事情与animateWithDuration的帮助:延迟:选项:动画:compeletion方法鸡蛋不反弹。它好像挂在春天。

回答

1

OK,我已经找到了微妙的细部每个人都需要采取的笔记,以获得动画和过渡与方法工作提供的iOS 4和later.When指定因为我们必须在方法动画/过渡选择使用常量与它的“选项”字。因此,而不是写

UIViewAnimationCurveEaseIn|UIViewAnimationTransitionCurlUp 

我们应该固定在动画工作就好后写

。我能得到真正的弹跳效果