Ios 获取UINavigationController中的转换百分比

Ios 获取UINavigationController中的转换百分比,ios,swift,uinavigationcontroller,transition,presentviewcontroller,Ios,Swift,Uinavigationcontroller,Transition,Presentviewcontroller,我在同一个UINavigationController中显示了两个UIView;视图A和视图B 在转换过程中,因为我想应用一些自定义动画样式,所以我想知道UINavigationController中演示进度的百分比。我该怎么做 我想要这样一个函数: class ExampleNavigationController: UINavigationController { func viewControllerMoves(from: UIViewController, to: UIVie

我在同一个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

    }

}
用户在更新期间也应调用此函数: 示例-->

我该怎么做

示例屏幕

百分比为0.50

百分比为1.00

百分比为0.00


UIViewControllerTransitionCoordinator协议正好提供您所需的功能。在
UIViewControllerTransitionCoordinatorContext
中,您将找到一个适用于交互式转换的
完成百分比。对于非交互式过渡,它具有所有需要在其旁边设置动画的内容