popViewControllerAnimated:自定义的过渡动画? [英] popViewControllerAnimated: custom transition animation?

查看:686
本文介绍了popViewControllerAnimated:自定义的过渡动画?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是的,我一直在寻求一个答案了。该解决方案工作,没有除了一个不给出淡入过渡的选项,仅翻转或卷曲。

Yes, I have looked for an answer already. None of the solutions work, except one that doesn't give the option for a fade transition, only flip or curl.

这样的:

methodname
    configure animation
    [self.navigationController popViewControllerAnimated:NO];

不管我什么各种过渡动​​画配置的,没有什么是仅使用典型的单线流行明显不同。如果我将其更改为 ...动画:YES]; ,我得到标准的流行动画,也许从破碎的配置奇怪的事情发生。

No matter what variety of transition animation config I try, nothing is visibly different from only using the typical single-line pop. If I change it to …Animated:YES];, I get the standard pop animation, maybe with something weird happening from the broken config.

所以我的问题是这样的:我怎样才能做一个弹出用,如果不是 CrossDissolve ,那么至少一些看起来一样吗?是,甚至有可能与导航控制器?

So my question is this: How can I do a pop with, if not CrossDissolve, then at least something that looks the same? Is that even possible with a navigation controller?

使用模式的意见将有默认的动画我想,我可以管理视图栈很轻松了,但我并不想这样做。

Using modal views would have the default animation I want, and I could manage the view stack easily enough, but I don't want to do that.

推荐答案

有关这种转换我真的建议一个模式视图控制器,这就是制度设计的方式。

For this type of transition I would really recommend a modal view controller, thats the way the system was designed.

但是,如果你坚持使用导航控制器有一个办法,虽然有点难看。

But if you insist on using the navigation controller there is a way, though somewhat ugly.

[CATransaction begin];
[CATransaction setValue:(id)kCFBooleanTrue forKey:kCATransactionDisableActions];

CATransition *transition = [CATransition animation];
[transition setType:kCATransitionFade];
[self.navigationController.view.layer addAnimation:transition forKey:@"someAnimation"];

[self.navigationController popViewControllerAnimated:YES];
[CATransaction commit];

CATransaction 将禁用所有标准的动画。在 CATransition 增加时次被交换淡入淡出过渡到导航控制器层(在这种情况下,除去被弹出的的ViewController视图)。

The CATransaction will disable all standard animations. The CATransition adds a fade transition to the navigation controller layer when views are swapped (in this case removing the viewcontroller view that is popped).

这篇关于popViewControllerAnimated:自定义的过渡动画?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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