我有一个自定义的UIViewController转换,基本上将即将到来的ViewController堆叠到屏幕上当前的ViewController的右侧,并将它们向左(推)或右(pop)滑动 .

我已经将过渡实现为交互式:

@objc private func addPanGestureRecognizer(_ gestureRecognizer: UIScreenEdgePanGestureRecognizer) {
    guard let view = gestureRecognizer.view else { return }
    let progress = gestureRecognizer.translation(in: view).x / view.frame.size.width

    switch gestureRecognizer.state {
    case .began:
        interactionController = UIPercentDrivenInteractiveTransition()
        navigationController.popViewController(animated: true)
    case .changed:
        interactionController.update(progress)
    default:
        if progress >= 0.5 {
            interactionController.finish()
        } else {
            interactionController.cancel()
        }

        interactionController = nil
    }
}

当我从屏幕的左边缘应用滑动手势时,上面的手势动作会启动我的自定义转换,虽然它不会以交互方式发生但只是完全运行我的自定义动画 .

是什么导致它不采取交互行动?

附:上述手势动作作为 UIScreenEdgePanGestureRecognizer 的动作添加到推动视图控制器的视图中 .