如何在不丢失选项卡的情况下在选项卡式应用程序上加载另一个视图控制器

How to load another View Controller on Tabbed application Without losing the tab

我有一个用 Objective-c 编码的标签栏应用程序。我拥有的 tabviews 之一是 TableView。我想要做的是,当这个 TableView 的一个单元格被选中时,应用程序会将用户带到另一个视图,但这个视图不在选项卡菜单上,我不想在以下情况下丢失选项卡菜单出现此视图。

可以吗?如何?在网上找不到太多内容。

If you are having the single View Controller to show then you can try doing this by adding the new view controller's view as subView to the current view controller's view

例如:

newVC.view.frame = self.view.frame;
newVC.view.frame.size.height = self.view.frame.size.height - HEIGHT_OF_TAB_BAR;
[self.view addSubview:newVC.view];

If there are more View Controller's that are adding further then using the navigation controller under tab bar controller will also work.

参考:How to implement tab bar controller with navigation controller in right way

只需将导航控制器嵌入到具有表格视图的选项卡 viewcontroller。

因此您的视图层次结构应该类似于标签栏控制器 - 导航控制器 - viewcontroller(标签) - 详细信息viewcontroller

您可以通过 selecting viewcontroller 嵌入导航控制器,然后从菜单 select 编辑器中嵌入导航控制器。

希望这会有所帮助:)