不要在自己的类中采用此协议,也不应直接创建采用此协议的对象。在转换期间,该转换中涉及的动画对象从UIKit接收完全配置的上下文对象。
但是如果我们看看UIKit框架中的UIViewControllerContextTransitioning
声明:
//
// ...
//
// The UIViewControllerContextTransitioning protocol can be adopted by custom
// container controllers. It is purposely general to cover more complex
// transitions than the system currently supports. For now, navigation push/pops
// and UIViewController present/dismiss transitions can be
// customized. Information about the transition is obtained by using the
// viewControllerForKey:, initialFrameForViewController:, and
// finalFrameForViewController: methods. The system provides two keys for
// identifying the from view controller and the to view controller for
// navigation push/pop and view controller present/dismiss transitions.
//
// ...
//
public protocol UIViewControllerContextTransitioning : NSObjectProtocol { ... }
那么,我们可以吗?
我想创建一个自定义容器视图控制器,如果在插入或移除其中一个子项时想要管理转换,则可以为另一个对象提供上下文。 Just as UINavigationController
does