需要在基于标签栏导航的应用程序中隐藏底部栏
我在基于选项卡导航的应用程序中遇到问题。我有一个带有 3 个选项卡栏按钮项目的选项卡栏。
每个选项卡栏项目,我需要显示导航控制器的视图。当我单击第一个按钮时,我需要显示导航控制器的根视图。
我需要在推送导航控制器的视图时,然后在一个视图中我需要显示选项卡栏。当按下第二个视图时,我需要隐藏选项卡栏。当第三个视图被推送时,我需要再次显示选项卡栏。当视图弹出时它也应该起作用。
在导航控制器的根视图(主视图)中,我需要在底部显示选项卡栏。但是推送了一个新视图(第一个视图),然后我需要隐藏选项卡栏。然后我将属性 hidesBottomBarWhenPushed
设置为 YES。
FirstViewController *firstController = [[FirstViewController alloc]initWithNibName:@"FirstViewController" bundle:nil];
firstController. hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:firstController animated:YES];
它在第一个视图中工作得很好。
但问题是,当我推送新视图(第二个视图)时,即使我设置了属性,选项卡栏也不会显示:
SecondViewController *secondController = [[SecondViewController alloc]initWithNibName:@"SecondViewController" bundle:nil];
secondController. hidesBottomBarWhenPushed = NO;
[self.navigationController secondController animated:YES];
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];
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
让我知道这是否有效。
Let me know if this works.