How to remove UIParallaxDimmingView in pop UIViewController?

心已入冬 提交于 2019-12-22 10:36:42

问题


I have a UIViewController vc1 which is pushed after UIViewController vc2. Both vc1 and vc2 are with transparent background.

Problem: When I try to pop vc2 with interactive pop gesture (pan from edge), in my view stack appears mysterious UIParallaxDimmingView which darkens my stack (under transparent view controllers there is a background image). As soon as I release finger, cancel or finish transition it becomes clear/transparent again.

How can i disable/remove UIParallaxDimmingView or set it transparent?


回答1:


If it is pushing a VC(still animating) when you try to pop VC with interactive pop gesture(pan from edge), the app may be frozen. This can help you :

/ 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;
    }
}


来源:https://stackoverflow.com/questions/48081742/how-to-remove-uiparallaxdimmingview-in-pop-uiviewcontroller

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!