adrian
adrian

Reputation: 4594

navigationBar of UINavigationController dissappears

I have this:

FirstViewController:

SecondViewController *secondViewController = [[SecondViewController alloc] init];
  [self.navigationController pushViewController:secondViewController animated:YES];

SecondViewController:

   - (void)viewDidLoad
{
    [super viewDidLoad];
    [self.navigationController setNavigationBarHidden:YES];   
}

My problem is that when I comeback from SecondViewController to FirstViewController the NavigationBar is still hidden.Is there a way to make it appear when I'm back in FirstViewController?

Upvotes: 0

Views: 78

Answers (3)

iamsult
iamsult

Reputation: 1579

You need to set [self.navigationController setNavigationBarHidden:NO]; This will do.

Upvotes: 1

Max MacLeod
Max MacLeod

Reputation: 26652

Yep, it's always possible that a different navigation controller will have set the bar to be hidden. So, in your viewWillAppear set the flag as follows:

    self.navigationController.navigationBarHidden = NO;

Upvotes: 1

Fran Sevillano
Fran Sevillano

Reputation: 8163

In the FirstViewController.m:

-(void)viewWillAppear:(BOOL)animated
{
    [self.navigationController setNavigationBarHidden:NO];  
}

Upvotes: 1

Related Questions