我可以“蜷缩"吗?popViewControllerAnimated 上的页面? [英] Can I "curl down" a page on popViewControllerAnimated?

查看:31
本文介绍了我可以“蜷缩"吗?popViewControllerAnimated 上的页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以用这个代码卷起"一个视图控制器:

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).

谢谢

推荐答案

好吧,我的旧答案完全错误...问题是您在设置过渡视图之前弹出视图控制器.如果你把代码改成这样:

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];

效果很好

这篇关于我可以“蜷缩"吗?popViewControllerAnimated 上的页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆