【问题标题】:Enable back back swipe gesture when using custom navigation controller使用自定义导航控制器时启用后退滑动手势
【发布时间】:2016-11-24 14:41:05
【问题描述】:

我有一个自定义导航控制器声明如下。我的问题是,一旦我实现了这个,返回到上一个堆栈的向后滑动手势(interactivepopgesturerecognizer)就不起作用了。如何重新启用它?我的应用程序中有很多视图控制器。谢谢。

    #import "NavController.h"

    @interface NavController ()
    {
        BOOL shouldIgnorePushingViewControllers;
    }

    @end

    @implementation NavController

    -(instancetype)init {
        self = [super init];
        self.delegate=self;

        return self;

    }

    -(void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
    {
        if (!shouldIgnorePushingViewControllers)
        {
            [super pushViewController:viewController animated:animated];
        }

        shouldIgnorePushingViewControllers = YES;
    }

    - (void)didShowViewController:(UIViewController *)viewController animated:(BOOL)animated
    {
        shouldIgnorePushingViewControllers = NO;
    }

    @end

【问题讨论】:

标签: ios uinavigationcontroller uigesturerecognizer


【解决方案1】:

尝试启用属性

self.interactivePopGestureRecognizer.enabled = YES;

init方法

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-11-12
    • 1970-01-01
    • 2011-09-13
    • 2014-03-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多