Search code examples
iosobjective-cxcodeios7

How to turn off the automatic gesture to go back a view with a navigation controller?


So I'm noticing all of my views are receiving the gesture to go back (pop a view) when the user swipes on the very left side of the screen (in either orientation) (This is new with iOS7)

I've tried so far with no avail to turn it off using:

    [self.navigationItem setHidesBackButton:YES];

Within the init of the NavigationController itself (as the delegate seems to be using that).


Solution

  • obj-c

    self.navigationController.interactivePopGestureRecognizer.enabled = NO;
    

    swift

    navigationController?.interactivePopGestureRecognizer?.isEnabled = false