首页 > 解决方案 > Swift 5 PopGesture 问题

问题描述

我对 interactivePopGestureRecognizer 有疑问。在我的应用程序中,当我在我的第一个视图控制器中做左滑动手势时(没有任何先前的屏幕),我的应用程序冻结了。当我查看调试面板时,看起来第二个视图控制器正在显示,但在卷轴设备中,它在第一个视图控制器中冻结。如果我向左滑动手势,我的应用程序就会恢复正常。

我一直在尝试该解决方案,但对我不起作用=>

我还将 UINavigationViewController,UITabbarNavigationViewController 插入到我的 BaseViewController

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

面板屏幕的外观与这张照片中的相同。

在此处输入图像描述

标签: iosswiftuigesturerecognizerswift5

解决方案


推荐阅读