【问题标题】:UINavigationController transition delegateUINavigationController 转换委托
【发布时间】:2016-05-29 00:56:38
【问题描述】:

我已经实现了 UINavigationControllerDelegate 方法:

public func navigationController(navigationController: UINavigationController, animationControllerForOperation operation: UINavigationControllerOperation, fromViewController fromVC: UIViewController, toViewController toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? { }

因为我必须设置应用程序状态并且只有能够捕获我的UINavigationControllerPop transition 的“事件”是这种方法。一切正常,但就该功能而言,但现在我的向后滑动操作不起作用(仅按下后退按钮有效)。

在这个方法结束时,我返回了 nil,因为我不知道它在做什么,但显然它会影响滑动到后退的功能。

是否有任何默认的UIViewControllerAnimatedTransitioning 可以让我返回以具有回扫功能?

谢谢。

【问题讨论】:

    标签: ios swift animation uinavigationcontroller


    【解决方案1】:

    我切换到这个委托方法:

    public func navigationController(navigationController: UINavigationController, willShowViewController viewController: UIViewController, animated: Bool) { 
        if self.viewControllerCount - 1 == self.rootController.viewControllers.count {
           // Pop action, do additional logic
       }
    }
    

    并对其进行自定义,以便我可以确定它的弹出操作(跟踪视图控制器的最后数量。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-10-31
      • 1970-01-01
      • 2011-05-01
      • 2012-04-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多