【问题标题】:How to remove UIParallaxDimmingView in pop UIViewController?如何在弹出 UIViewController 中删除 UIParallaxDimmingView?
【发布时间】:2018-06-13 09:14:52
【问题描述】:

我有一个UIViewController vc1,它在UIViewController vc2 之后被推送。 vc1vc2 都是透明背景。

问题: 当我尝试使用交互式弹出手势(从边缘平移)弹出 vc2 时,在我的视图中堆栈出现了神秘的UIParallaxDimmingView,这使我的堆栈变暗(在透明视图控制器下有一个背景图像)。 只要我松开手指、取消或完成过渡,它就会再次变得清晰/透明。

如何禁用/删除UIParallaxDimmingView 或将其设置为透明?

【问题讨论】:

    标签: ios objective-c iphone uiviewcontroller


    【解决方案1】:

    如果当您尝试使用交互式弹出手势(从边缘平移)弹出 VC 时,它正在推送 VC(仍在动画中),则应用程序可能会被冻结。这可以帮助你:

    / set gesture no when pushViewController /
    - (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
    {
        if ([self respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
            self.interactivePopGestureRecognizer.enabled = NO;
        }
    
        [super pushViewController:viewController animated:animated];
    }
    
    / set gesture yes when showViewController /
    - (void)navigationController:(UINavigationController )navigationController didShowViewController:(UIViewController )viewController animated:(BOOL)animated
    {
        if ([navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
            navigationController.interactivePopGestureRecognizer.enabled = YES;
        }
    
        / if rootViewController, set delegate nil /
        if (navigationController.viewControllers.count == 1) {
            navigationController.interactivePopGestureRecognizer.enabled = NO;
            navigationController.interactivePopGestureRecognizer.delegate = nil;
        }
    }
    

    【讨论】:

      猜你喜欢
      • 2018-05-22
      • 1970-01-01
      • 2023-04-06
      • 2018-06-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-27
      相关资源
      最近更新 更多