Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No Swipe Back when hiding Navigation Bar in UINavigationController

I love the swipe pack thats inherited from embedding your views in a UINavigationController. Unfortunately i cannot seem to find a way to hide the NavigationBar but still have the touch pan swipe back gesture. I can write custom gestures but I prefer not to and to rely on the UINavigationController back swipe gesture instead.

if I uncheck it in the storyboard, the back swipe doesn't work

enter image description here

alternatively if I programmatically hide it, the same scenario.

- (void)viewDidLoad {     [super viewDidLoad];     [self.navigationController setNavigationBarHidden:YES animated:NO]; // and animated:YES } 

Is there no way to hide the top NavigationBar and still have the swipe?

like image 706
mihai Avatar asked Jul 12 '14 06:07

mihai


People also ask

How do I hide the back button on my navigation?

Way 1: Touch “Settings” -> “Display” -> “Navigation bar” -> “Buttons” -> “Button layout”. Choose the pattern in “Hide navigation bar” -> When the app opens, the navigation bar will be automatically hidden and you can swipe up from the bottom corner of the screen to show it.

How do I show hidden navigation bar?

The navigation bar is pinned by default. If you want to view files or use apps in full screen, double-tap the Show and hide button to hide the navigation bar. To show the navigation bar again, drag upwards from the bottom of the screen.

How do I hide navigation bar in storyboard?

Click on the controller that has the top bar navigate to the properties bar on the right hand side of Xcode. There is a drop down labeled Top Bar (as shown above) change this drop down to none.


Video Answer


1 Answers

A hack that is working is to set the interactivePopGestureRecognizer's delegate of the UINavigationController to nil like this:

[self.navigationController.interactivePopGestureRecognizer setDelegate:nil]; 

But in some situations it could create strange effects.

like image 57
HorseT Avatar answered Sep 17 '22 19:09

HorseT