iOS Tips and Tricks

Disable back swipe gesture in UINavigationController

From iOS 7 there is a new navigation behavior.
You can swipe from left border of the screen to go back on navigation stack.

How can you disable this behavior? Get the solution below (replace self.navigationController with self when you are in the UINavigationController class)

Swift :

self.navigationController?.interactivePopGestureRecognizer.enabled = false;

Objective C :

if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
self.navigationController.interactivePopGestureRecognizer.enabled = NO;

Reference Links:

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.