简体   繁体   English

没有标签栏项目的UITabBarController中的UIViewController

[英]UIViewController in a UITabBarController without tab bar item

So I have this application where I have a view controller (which I want to appear first when the app starts) and a tab bar controller. 因此,我在此应用程序中拥有一个视图控制器(该应用程序启动时首先显示)和一个标签栏控制器。 I also have other navigation bar controllers that are in the tab bar controller. 我还具有选项卡栏控制器中的其他导航栏控制器。 I want to place my view controller on top of the tab bar controller. 我想将视图控制器放在选项卡栏控制器的顶部。 Making the tab bar controller the parent of the view controller would be better though. 不过,将标签栏控制器设为视图控制器的父级会更好。

像这样 :

But take note, I do not want a tab bar item to represent the view controller and I want the tab bar to appear along with the view controller. 但是请注意,我不希望选项卡栏项代表视图控制器,并且我希望选项卡栏与视图控制器一起显示。 I do not and would not want to use storyboards as much as possible. 我不会也不想尽可能使用情节提要。 How can i achieve this? 我怎样才能做到这一点?

I guess the simplest solution would be to use a screenshot of your tabBar and put it in your HomeViewController as a button. 我猜最简单的解决方案是使用tabBar的屏幕截图并将其作为按钮放在HomeViewController中。 In this case you could use your HomeViewController as rootViewController and in the button action you set the TabBarController as the rootViewController . 在这种情况下,您可以将HomeViewController用作rootViewController并在按钮操作中将TabBarController设置为rootViewController

Root = Home + Button 根=主页+按钮
--> - >
Root = TabBar 根= TabBar

Perhaps you need four buttons, if you want the correct tab to be selected. 如果要选择正确的选项卡,可能需要四个按钮。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM