Search code examples
iphoneiosuitabbarcontrolleruitabbar

Showing Bottom bar while pushing


I am hiding my tabbar while navigating to first view to secondView,But how can I show it back while poping from second view to first view

In first view

 -(IBAction)gotoSecondView{

   VideoDetailViewController *vdoDtlPage = [[VideoDetailViewController alloc]initWithNibName:@"VideoDetailViewController" bundle:nil];


    self.hidesBottomBarWhenPushed=YES;

    [self.navigationController pushViewController:vdoDtlPage animated:YES];
    }

From Second View

  -(IBAction)back:(id)sender{

   self.hidesBottomBarWhenPushed=NO;
  [self.navigationController popViewControllerAnimated:YES];

  }

Solution

  • self.hidesBottom... makes the navigationController hide the bottom bar while the VC this is set for is on the stack

    so instead of hiding it for the root, hide it for vdoDtlPage

    -(IBAction)gotoSecondView{
        VideoDetailViewController *vdoDtlPage = [[VideoDetailViewController alloc]initWithNibName:@"VideoDetailViewController" bundle:nil];
        vdoDtlPage.hidesBottomBarWhenPushed=YES;
        [self.navigationController pushViewController:vdoDtlPage animated:YES];
    }
    

    then, when you pop the secondView, firstViews is the top VC again and as it has hidesBottomBar=No, the navi controller will animate in the bar again