I have a UITableView and it has a nav bar(got from UINavigationViewController), it's able to go back by sliding back using a finger.
I tried to hide the nav bar but keep the slide-back ability, code:
- (void)viewWillAppear:(BOOL)animated { [[self navigationController] setNavigationBarHidden:YES animated:YES]; }
This successfully hid the nav bar, however, I can no longer slide back to the last screen either.
Is there any way to hide the nav bar but keep the slide-back ability?
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.
You can find the Website View menu in what's called the Smart Search field at the top of the Safari interface. Launch the app and navigate to a website, then tap the "aA" icon in the upper left corner of the screen. Simply select Hide Toolbar from the dropdown menu, and the toolbar will shrink to show just the URL.
The . navigationBarBackButtonHidden(true) will hide the back button.
Tested with Swift 2 the solution of @gabbler, if you use
self.navigationController?.navigationBar.hidden = true
Swift 3.0
self.navigationController?.navigationBar.isHidden = true
instead of
self.navigationController?.navigationBarHidden = true
the swipe back gesture works like a charm!
Found the solution:
- (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; // hide nav bar [[self navigationController] setNavigationBarHidden:YES animated:YES]; // enable slide-back if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) { self.navigationController.interactivePopGestureRecognizer.enabled = YES; self.navigationController.interactivePopGestureRecognizer.delegate = self; } } - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer { return YES; }
And in .h file, conform to UIGestureRecognizerDelegate
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With