开发者

navigationBar of UINavigationController dissappears

开发者 https://www.devze.com 2023-04-06 05:37 出处:网络
I have this: FirstViewController: SecondViewController *secondViewController = [[SecondViewController alloc] init];

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?


In the FirstViewController.m:

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


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;


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

0

精彩评论

暂无评论...
验证码 换一张
取 消