Reputation: 835
in my project i have loginviewcontroller in this view i hide navigationcontroller in viewWillAppear method if login successful i have below code
-(void)gotoCheckinPage{
DashboardViewController *v = [[DashboardViewController alloc]
initWithNibName:@"DashboardViewController" bundle:nil];
UINavigationController *navCon = [[UINavigationController alloc]
initWithRootViewController:v];
[navCon.navigationBar setBackgroundImage:[UIImage imageNamed:@"navbar_bg.png"]
forBarMetrics:UIBarMetricsDefault];
[self presentViewController:navCon animated:YES completion:nil];
}
but in dashboard view controller navigationcontroller not shown
this is how i hide navigationcontroller in loginview
- (void)viewWillAppear:(BOOL)animated {
[self.navigationController setNavigationBarHidden:YES animated:animated];
[super viewWillAppear:animated];
}
- (void)viewWillDisappear:(BOOL)animated {
[self.navigationController setNavigationBarHidden:NO animated:animated];
[super viewWillDisappear:animated];
}
if i comment the line :
[self.navigationController setNavigationBarHidden:YES animated:animated];
there is no problem but want to get hidden navigationcontroller in loginview then set to active in other view controllers
any help?
Upvotes: 0
Views: 46
Reputation: 4513
You can simply add this in your LoginViewController:
-(void)viewWillAppear:(BOOL)animated
{
self.navigationController.navigationBarHidden = YES; // Where you want to hide it.
}
And in the DashboardViewController:
-(void)viewWillAppear:(BOOL)animated
{
self.navigationController.navigationBarHidden = NO; // Where you want to show it.
}
Upvotes: 1
Reputation: 6454
Write down this code in your view . in which you wants to show navigation
-(void)viewWillAppear:(BOOL)animated{
self.navigationController.navigationBarHidden = NO;
}
Upvotes: 1