iosios8swrevealviewcontrollerios8.2

How do I remove navigation tab added by SWRevealViewController?


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.


Solution

  • As your front view is mainView you will be using

    [mainView.navigationController setNavigationBarHidden:YES];
    

    I hope this helps.