Can I “curl down” a page on popViewControllerAnimated?

谁说胖子不能爱 提交于 2019-12-22 17:44:08

问题


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

[UIView beginAnimations:@"animation" context:nil];
[self.navigationController pushViewController: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


回答1:


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




回答2:


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



来源:https://stackoverflow.com/questions/3699882/can-i-curl-down-a-page-on-popviewcontrolleranimated

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!