我在基于 Tabbar 导航的应用程序中遇到问题。我有一个包含 3 个标签栏按钮项的标签栏。
每个选项卡栏项目,我需要显示导航 Controller 的 View 。当我点击第一个按钮时,我需要显示导航 Controller 的 Root View 。
我需要在推送导航 Controller 的 View 时,在一个 View 中显示标签栏。推送第二个 View 时,我需要隐藏标签栏。推送第三个 View 时,我需要再次显示标签栏。它也应该在弹出 View 时起作用。
在导航 Controller 的 Root View (主视图)中,我需要在底部显示标签栏。但是推了一个新 View (第一个 View )然后我需要隐藏标签栏。然后我将属性 hidesBottomBarWhenPushed
设置为 YES。
FirstViewController *firstController = [[FirstViewController alloc]initWithNibName:@"FirstViewController" bundle:nil];
firstController. hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:firstController animated:YES];
它在第一个 View 中运行良好。
但问题是当我推送一个新 View (第二个 View )时,即使我设置了属性也没有显示标签栏:
SecondViewController *secondController = [[SecondViewController alloc]initWithNibName:@"SecondViewController" bundle:nil];
secondController. hidesBottomBarWhenPushed = NO;
[self.navigationController secondController animated:YES];
最佳答案
让我知道这是否有效。
FirstViewController *firstController = [[FirstViewController alloc]initWithNibName:@"FirstViewController" bundle:nil];
//firstController. hidesBottomBarWhenPushed = YES;
[self.navigationController presentViewController:firstController animated:YES];
关于iphone - 需要在基于标签栏导航的应用程序中隐藏底部栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8757968/