需要在基于标签栏导航的应用程序中隐藏底部栏

发布于 2024-12-25 12:37:34 字数 931 浏览 4 评论 0原文

我在基于选项卡导航的应用程序中遇到问题。我有一个带有 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

初熏 2025-01-01 12:37:34

让我知道这是否有效。

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

Let me know if this works.

FirstViewController *firstController = [[FirstViewController alloc]initWithNibName:@"FirstViewController" bundle:nil];
//firstController. hidesBottomBarWhenPushed = YES;
[self.navigationController presentViewController:firstController animated:YES];
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文