How to disable back gesture in iOS 7 for only one view

后端 未结 6 1599
自闭症患者
自闭症患者 2020-12-18 06:26

I am trying to disable the back gesture for my view controller using the following set of code.

In FirstViewController.m, I\'m setting the delegate of <

6条回答
  •  生来不讨喜
    2020-12-18 07:18

    Try the below untested code in your FirstViewController :

    -(void) viewWillAppear:(BOOL)animated 
    {
        [super viewWillAppear:animated];
        self.navigationController.interactivePopGestureRecognizer.enabled = NO;
    }
    
    -(void) viewWillDisappear:(BOOL)animated 
    {
        [super viewWillDisappear:animated];
        self.navigationController.interactivePopGestureRecognizer.enabled = YES;
    }
    

提交回复
热议问题