When I swipe from left to right on navigation bar, my navigation controller pops a view controller. I already looked at this question so I know I can set ...
self.navigationController.interactivePopGestureRecognizer.enabled = NO;
... but it just disables the swipe on the view below the navigation bar, not the bar itself.
My current solution is to manually find the gesture and disable it. Which works, but not sure if there's a better way. The navigation bar doesn't seem to have a property like interactivePopGestureRecognizer
.
// This is inside a `UINavigationController` subclass.
for (UISwipeGestureRecognizer *gr in self.navigationBar.gestureRecognizers) {
if ([gr isKindOfClass:[UISwipeGestureRecognizer class]] && gr.direction == UISwipeGestureRecognizerDirectionRight) {
gr.enabled = NO;
}
}