1

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];

  }

2 Answers2

0

One option is to use NSNotificationCenter

Look at the answer here IOS: Move back two views

Basically you add a notification method to your parent viewcontroller when you dismiss view VideoDetailViewController you call that notification and it runs a method lets say

  -(IBAction)back:(id)sender{

    [self.navigationController popViewControllerAnimated:YES];
    [[NSNotificationCenter defaultCenter] postNotificationName:@"showTabBar" object:nil];

  }

then your related method in your parent view contorller runs

- (void)showTabBar:(NSNotification *)notif
    {
        NSLog(@"Received Notification ");

        self.hidesBottomBarWhenPushed=NO;
}
Community
  • 1
  • 1
SpaceDust__
  • 4,844
  • 4
  • 43
  • 82
0

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

Daij-Djan
  • 49,552
  • 17
  • 113
  • 135