Charalampos
Charalampos

Reputation: 59

How to hide the NavigationBar when i use SWRevealViewController embed in UINavigationController?

When i use SWRevealViewController as initial view or not embedded in UINavigationController the result is as i expected:

enter image description here

but when the SWRevealViewController comes from UINavigationController tee result is: enter image description here

How can i avoid the NavigationBar presented in the Rear view?

Upvotes: 2

Views: 1722

Answers (3)

Rushi Deshpande
Rushi Deshpande

Reputation: 31

Please add the following code to the viewWillAppear: method of the viewcontroller whose navigation bar you need to hide.

  [super viewWillAppear:YES];
[self.navigationController.navigationBar setHidden:YES];
[self.navigationController.navigationBar.backItem setHidesBackButton:YES];

Upvotes: 1

Maq
Maq

Reputation: 403

If you really need Navigation Controller on top of SWRevealViewController:

You got to hide navigation bar from navigation controller of your SWRevealViewController. U can do this in IB (assuming you are using Storyboards):

  1. Select Navigation Controller in your Storyboard
  2. Open Attributes inspector
  3. Find section "Navigation Controller", uncheck "Shows Navigation Bar"

Where to set navigation bar to hidden

Next, If you want navigation bard in front view controller, then attach it to separate Navigation Controller. You will have two Navigation Controllers, think on which one you want to push - it will have different effect.

Upvotes: 0

vpx
vpx

Reputation: 108

Try, this code for rear view controller

- (void)viewWillAppear:(BOOL)animated
{ 
    self.navigationController.navigationBar.hidden = YES;
}

Upvotes: 0

Related Questions