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

Mar*_*hex 5 uinavigationcontroller ios swift

我需要将 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;
    }
}
Run Code Online (Sandbox Code Playgroud)

神秘的_UIParallaxDimmingView。它是什么?

当推送或弹出时,应用程序在 iOS 8 上冻结

iOS 应用程序在 PushViewController 上冻结

更新 这是最初的问题如何在弹出的 UIViewController 中删除 UIParallaxDimmingView?

小智 0

雨燕5

例如,在推送 viewController 时,只需使用 false 删除动画即可。十分简单。

navigationController?.pushViewController(YourController, 动画: false)

  • 在保留动画的同时还有其他方法可以解决这个问题吗? (2认同)