如何在将视图控制器推送到另一个视图控制器时处理 UIParallaxDimmingView?

How to deal with the UIParallaxDimmingView while pushing a view controller to another?

我需要将 UIParallaxDimmingView 设为白色或透明。

vc1 的白色背景受此 UIParallaxDimmingView 的影响,使其在动画结束后过渡到 vc2 时呈现浅灰色,vc2 获得其白色背景。

我进行了研究,找到了这段代码,但对我不起作用。

func navigationController(_ navigationController: UINavigationController, didShow viewController: UIViewController, animated: Bool) {
    if (navigationController.viewControllers.count > 1)
    {
         self.navigationController?.interactivePopGestureRecognizer?.delegate = self
        navigationController.interactivePopGestureRecognizer?.isEnabled = true;
    }
    else
    {
         self.navigationController?.interactivePopGestureRecognizer?.delegate = nil
        navigationController.interactivePopGestureRecognizer?.isEnabled = false;
    }
}

Mysterious _UIParallaxDimmingView. What is it?

App freeze on ios 8 when push or pop

更新 这是最初的问题 How to remove UIParallaxDimmingView in pop UIViewController?

Swift 5

例如,在推送 viewController 时,只需删除带有 false 的动画。简单易行。

navigationController?.pushViewController(YourController, animated: false)