如何在pop UIViewController中删除UIParallaxDimmingView?

Mar*_*bia 5 iphone objective-c uiviewcontroller ios

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

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

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

小智 0

如果当您尝试使用交互式弹出手势(从边缘平移)弹出 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;
    }
}
Run Code Online (Sandbox Code Playgroud)