Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I've hidden the navigation bar and the status bar, now the screen edge pan gesture to go back won't work, is this typical?

I'm curious, if I set the navigationBar to hidden, and also hide the status bar, my view controller no longer responds to the screen edge gesture to pop the view controller.

Is this expected behaviour? I tried to set the interactivePopGestureRecognizer to enabled in viewDidLoad after I hide the navigation bar, but it still won't work.

like image 444
Doug Smith Avatar asked Nov 25 '25 20:11

Doug Smith


2 Answers

[self.navigationController.navigationBar setHidden:YES];<--doesn't remove pop gesture

[self.navigationController setNavigationBarHidden:YES];<-- disables pop gesture

Simply use the first option, and in your root controller's viewDidAppear method use:

[self.navigationController.navigationBar setHidden:NO];
like image 71
mirceamironenco Avatar answered Nov 28 '25 12:11

mirceamironenco


Are you sure you've done things right? I've put together an example that seems to work for me. All I did was make the navigationController.navigationBar.hidden = YES and [[UIApplication sharedApplication] setStatusBarHidden:YES]

-edit-

After closer inspection, it looks like there are two different properties on UINavigationController. There is navigationBar which is the UINavigationBar view, and there is navigationBarHidden which is a boolean. When you set navigationBarHidden to true, the swipe gesture stops working. But if you set that actual view to be hidden with navigationBar.hidden then the gesture still works. Check the Git repository for an example.

like image 26
Jadar Avatar answered Nov 28 '25 13:11

Jadar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!