如何获得UIKit为我提供自定义过渡的过渡协调器? [英] How can I get UIKit to provide me with a transition coordinator for a custom transition?

查看:77
本文介绍了如何获得UIKit为我提供自定义过渡的过渡协调器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个管理多个子视图控制器的自定义容器视图控制器,就像 UIPageViewController 那样。

I'm writing a custom container view controller that manages multiple child view controllers, kind of like UIPageViewController does.

我希望客户能够在其职责范围之外的动画以及其子视图控制器之间的交互式过渡,但是我似乎找不到找到让UIKit给我过渡协调器的方法。

I would like clients to be able to animate stuff outside its area of responsibility alongside an interactive transition between its child view controllers, but I can't seem to find a way to get UIKit to give me a transition coordinator.

我真的必须为这样一个简单的任务创建一个实现该协议的自定义类吗?如果是这样,我将如何实现 -animateAlongsideTransition:completion:

Do I really have to make a custom class implementing this protocol for such a simple task? If so, how would I go about implementing -animateAlongsideTransition:completion:?

推荐答案

如果您要谈论的是从子视图控制器获得的过渡协调器(即UIViewController的 transitionCoordinator 属性),则不会能够从系统中获取一个。仅在非常有限的情况下才提供此类过渡协调器。

If you're talking about the kind of transition coordinator you get from a child view controller (i.e. the transitionCoordinator property of a UIViewController), you're not going to be able to get one from the system. Such transition coordinators are supplied only under a very limited set of circumstances.

例如,允许您为UITabBarController编写自定义过渡动画,可能是交互式的,但是在在任何情况下,您都无法从进行过渡的任何子视图控制器中获取过渡协调器;我认为这是一个严重的错误。

For example, you are allowed to write a custom transition animation, possibly interactive, for UITabBarController, but under no circumstances are you able to obtain a transition coordinator from any of the child view controllers undergoing the transition; I regard this as a serious bug.

因此,在允许您为自定义过渡动画编写自定义过渡动画的情况下,您甚至无法获得过渡协调器。 内置父视图控制器,显然,在您尝试做自己的自己父视图控制器的情况下,获得一个的机会为零。

So, since you can't even get a transition coordinator in a situation where you are allowed to write a custom transition animation for a built-in parent view controller, obviously the chances of your getting one in a situation where you're trying to do your own parent view controller are zero.

这篇关于如何获得UIKit为我提供自定义过渡的过渡协调器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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