开发者

Can I "curl down" a page on popViewControllerAnimated?

I can "curl up" a view controller with this code:

[UIView beginAnimations:@"animation" context:nil];
[self.navigationController pushViewControll开发者_运维问答er:page animated:NO];
[UIView setAnimationDuration:1];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.navigationController.view cache:NO]; 
[UIView commitAnimations];

but I can't curl down the last page like this:

[UIView beginAnimations:@"animation" context:nil];
[self.navigationController popViewControllerAnimated:NO];
[UIView setAnimationDuration:1];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:self.navigationController.view cache:NO]; 
[UIView commitAnimations];

any idea why not? I just really want to "reverse" the animation (as if a sticker has been peeled off to show the 'push'ed view controller and stuck back on when they click a button).

Thanks


Ok, my old answer was totally wrong... the problem is that you are popping the view controller before setting the transition view. If you change the code to this:

[UIView beginAnimations:@"animation" context:nil];
[UIView setAnimationDuration:1];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:self.navigationController.view cache:NO]; 
[self.navigationController popViewControllerAnimated:NO];
[UIView commitAnimations];

it works fine


Using OpenGL or a lot of complex CoreAnimation processes, I am sure that you could, but, It would be a lot of hassle for doing something like that. Something that might help you along: A simple book turning application written entirely with CoreAnimation

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜