Lucas Veiga
Lucas Veiga

Reputation: 1795

UINavigationController navigationBarHidden

Hey everbody, i'm having problem with a simple question.

I have a NavigationController, 01.xib ans 02.xib. I set in IB NavigationController to dont display the navigationBar. Well, when i go to 02.xib, i set it to appear.

[self navigationController].navigationBarHidden = NO;

Everything works fine.

But, when i come back to 01.xib with the top button, the bar still appearing in the 01.xib.

How can i fix that?

Thanks!

Upvotes: 1

Views: 3288

Answers (2)

Erdemus
Erdemus

Reputation: 2788

Use this in first view controller:

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

Upvotes: 3

Rob Howard
Rob Howard

Reputation: 41

I believe this is happening because they are referencing the same navigation controller.

You could set it hidden again in the viewDidAppear method of your 01 class.

-(void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
    [self navigationController].navigationBarHidden = YES;
}

Upvotes: 1

Related Questions