【问题标题】:Get transition percentage in UINavigationController在 UINavigationController 中获取过渡百分比
【发布时间】:2017-12-27 11:23:01
【问题描述】:

我在同一个 UINavigationController 中有两个 UIView;查看 A 和查看 B。

在过渡期间,因为我要应用一些自定义动画样式,所以我想知道 UINavigationController 内部的演示进度百分比。我该怎么做?

我想要这样的功能:

class ExampleNavigationController: UINavigationController {


    func viewControllerMoves(from: UIViewController, to: UIViewController, progress: CGFloat) {
        //I can read here how far the animation is and apply custom animation styles

    }

}

这个函数也应该在用户更新期间被调用: 示例 --> http://www.latet.nl/appvideo.mov

我该怎么做?

示例屏幕

百分比为 0.50

百分比为 1.00

百分比为 0.00

【问题讨论】:

    标签: ios swift uinavigationcontroller transition presentviewcontroller


    【解决方案1】:

    UIViewControllerTransitionCoordinator 协议正好满足您的需求。在UIViewControllerTransitionCoordinatorContext 中,您将找到一个适用于交互式过渡的percentComplete。对于非交互式过渡,它提供了您在它们旁边制作动画所需的一切。

    【讨论】:

      猜你喜欢
      • 2017-09-26
      • 2021-11-28
      • 2021-06-13
      • 1970-01-01
      • 2021-07-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多