2
votes

I'm having problem in Tabbar-Navigation based application. I have a tab bar with 3 tab bar button items.

Each Tab bar item, I need to show the Navigation controller's view. When I click on the first button, I need to show Navigation controller's root view.

I need that when navigation controller's view is pushed, then in one view I need to show tab bar. When second view is pushed, I need to hide tab bar. When third view is pushed, I need to show tab bar again. It should also work when the view is popped up.

In Navigation controller's root view (Main view), I need to show the tab bar at bottom. But a new view (first view) is pushed then I need to hide the tab bar. Then I have set the property hidesBottomBarWhenPushed to YES.

FirstViewController *firstController = [[FirstViewController alloc]initWithNibName:@"FirstViewController" bundle:nil];
firstController. hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:firstController animated:YES];

It works fine with the first view.

But the problem is when I push a new view (Second view) , tab bar is not shown even if I set the property:

SecondViewController *secondController = [[SecondViewController alloc]initWithNibName:@"SecondViewController" bundle:nil];
secondController. hidesBottomBarWhenPushed = NO;
[self.navigationController secondController animated:YES];
1
Is this correct ? [self.navigationController pushViewController:selImageList animated:YES]; Shouldn't it be firstController instead of selImageList ? - Illep

1 Answers

1
votes

Let me know if this works.

FirstViewController *firstController = [[FirstViewController alloc]initWithNibName:@"FirstViewController" bundle:nil];
//firstController. hidesBottomBarWhenPushed = YES;
[self.navigationController presentViewController:firstController animated:YES];