0

I am using am SWRevealViewController in my iOS 8.2 app. It works perfectly fine, but when my view displays though it a frosted navigation bar hangs around at the top of the screen, under the status bar. It is covering my background image, and I haven't found an easy way to remove it.

mainView = [[ViewController alloc] init];
sideMenu = [[MenuController alloc] init];

UINavigationController * frontViewController = [[UINavigationController alloc] initWithRootViewController:mainView];
UINavigationController * rearViewController = [[UINavigationController alloc] initWithRootViewController:sideMenu];

revealController = [[SWRevealViewController alloc] initWithRearViewController:rearViewController frontViewController:frontViewController];
revealController.delegate = mainView;

I searched through the SWRevealViewController code and didn't find anything obviously related to it. I tried commenting out suspicious sections of code and viewing the result. I hid the status bar. Nothing touched it.

I have tried a few things...

[frontViewController.navigationController setNavigationBarHidden:YES];
frontViewController.navigationController.navigationBar.frame = CGRectZero;
[frontViewController.navigationController.navigationBar setHidden:YES];

[revealController.navigationController setNavigationBarHidden:YES];
revealController.navigationController.navigationBar.frame = CGRectZero;
[revealController.navigationController.navigationBar setHidden:YES];
[revealController.navigationController.navigationBar setBounds:CGRectZero];

...to no effect.

eadsjr
  • 681
  • 5
  • 20

2 Answers2

0

Upon completion of this question, I tried one final test.

[mainView.navigationController setNavigationBarHidden:YES];

This worked. It would appear that something in the process of embedding the mainView in the SWRevealViewController caused the navigation bar in the mainView itself to become visible, even though by default it was not.

eadsjr
  • 681
  • 5
  • 20
0

As your front view is mainView you will be using

[mainView.navigationController setNavigationBarHidden:YES];

I hope this helps.

Ahsan Ebrahim Khatri
  • 1,807
  • 1
  • 20
  • 27
  • Thank you Ahsan, but this was already posted above. Though if you could give some insight as to why this is activating the otherwise dormant navigation bar I would appreciate it. – eadsjr Apr 09 '15 at 08:00
  • This is because you have this `mainView` in the front and so the `navigationBar` from the `navigationController` is appearing so if you have to hide the `navigationBar`, you will have to hide it from the `controller` that is in the front most and in your case its `mainView`. – Ahsan Ebrahim Khatri Apr 09 '15 at 08:03