【问题标题】:How to deal with the UIParallaxDimmingView while pushing a view controller to another?将视图控制器推送到另一个视图控制器时如何处理 UIParallaxDimmingView?
【发布时间】:2019-08-05 11:29:01
【问题描述】:

我需要将 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

iOS App Freezes on PushViewController

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

【问题讨论】:

  • 上面的代码有什么错误吗? stackoverflow.com/help/how-to-ask
  • 没有错误,实现是唯一似乎可以解决问题但没有解决问题的方法。我将代码添加到该导航控制器的根目录
  • 你想让它变白吗?对不起,亲爱的,但你的问题对我来说仍然有点混乱
  • 是的,我想让它变成白色或非彩色。

标签: ios swift uinavigationcontroller


【解决方案1】:

斯威夫特 5

例如,在推送 viewController 时,只需使用 false 删除动画。很容易。

navigationController?.pushViewController(YourController, animated: false)

【讨论】:

  • 在保留动画的同时还有其他方法可以解决这个问题吗?
  • 看起来还不是朋友
  • 我希望他们删除它或给我们另一种方式来处理它...
  • 我也是!也许很快,我们至少需要继续研究明年的 WWDC。
猜你喜欢
  • 1970-01-01
  • 2014-03-28
  • 1970-01-01
  • 2010-12-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-09-06
相关资源
最近更新 更多