我可以在 popViewController Animated 上“向下卷曲”页面吗?

2024-03-22

我可以使用以下代码“卷起”视图控制器:

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

但我不能像这样卷曲最后一页:

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

知道为什么不吗?我只是真的想“反转”动画(就好像贴纸已被剥离以显示“推送”的视图控制器并在单击按钮时粘回原处)。

Thanks


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

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

效果很好

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

我可以在 popViewController Animated 上“向下卷曲”页面吗? 的相关文章

随机推荐