仅在第一个视图上使用Tab Bar的导航控制器

时间:2023-01-13 19:39:44

I am seeking advice on how to start my project.

我正在寻求如何开始我的项目的建议。

I need to use a combination of the navigation controller and tabbar controller but on the second screen, I need the tabbar controller not to be there. Here is a brief description of the two main screens

我需要使用导航控制器和tabbar控制器的组合,但在第二个屏幕上,我需要tabbar控制器不在那里。以下是两个主要屏幕的简要说明

Screen 1 will have a tabbar controller with two tabs. The first tab is a tableview and when you tap on a table cell, it drills down to Screen 2. The second tab is just a filter view that updates the table in the first tab of Screen 1.

屏幕1将有一个带有两个选项卡的tabbar控制器。第一个选项卡是一个表格视图,当您点击表格单元格时,它会向下钻取到屏幕2.第二个选项卡只是一个筛选视图,用于在屏幕1的第一个选项卡中更新表格。

Screen two is just a details screen from the cells of Screen 1. The catch is that I don't want the TabBar on Screen 2.

屏幕2只是来自屏幕1的单元格的详细信息屏幕。问题是我不希望屏幕2上的TabBar。

I am struggling with how to get started.

我正在努力学习如何开始。

Do I start with a Navigation-based application since I need to be able to drill down? How do I just add a tab bar to the main screen of the navigation based app?

我是否从基于导航的应用程序开始,因为我需要能够向下钻取?如何将标签栏添加到基于导航的应用程序的主屏幕?

I can't start with a Tab Bar application because if I load a navigation controller inside one of the views of the tab controller, then when I drill down inside the nav controller, the tab bar still stays on the next screen when I need it to go away.

我无法从Tab Bar应用程序开始,因为如果我在选项卡控制器的其中一个视图中加载导航控制器,那么当我在导航控制器内部向下钻取时,标签栏仍然会在我需要时停留在下一个屏幕上走开。

Any help would be appreciated.

任何帮助,将不胜感激。

1 个解决方案

#1


0  

Hide the tab bar once the 2nd view gets pushed. You can hide it in the viewDidAppear method and animate it so that it looks fluid.

推送第二个视图后隐藏标签栏。您可以在viewDidAppear方法中隐藏它并为其设置动画,使其看起来流畅。

The navigation controller has a property that will do the work for you (put this just before you call the nav controller to push the new view):

导航控制器有一个属性可以为您完成工作(在调用导航控制器推动新视图之前放置它):

navigationControllerNameHere.hidesBottomBarWhenPushed = YES;

or

要么

- (void)viewWillAppear: (BOOL)animated { 
 self.hidesBottomBarWhenPushed = YES; 
}

#1


0  

Hide the tab bar once the 2nd view gets pushed. You can hide it in the viewDidAppear method and animate it so that it looks fluid.

推送第二个视图后隐藏标签栏。您可以在viewDidAppear方法中隐藏它并为其设置动画,使其看起来流畅。

The navigation controller has a property that will do the work for you (put this just before you call the nav controller to push the new view):

导航控制器有一个属性可以为您完成工作(在调用导航控制器推动新视图之前放置它):

navigationControllerNameHere.hidesBottomBarWhenPushed = YES;

or

要么

- (void)viewWillAppear: (BOOL)animated { 
 self.hidesBottomBarWhenPushed = YES; 
}