一尘不染

如何在Swift上的Storyboard中使用UITabBarController内部的Navigation Controller

swift

enter image description
here我用的很快。我想在Storyboard的TabBar内部使用Navigation。首先,第一个显示出现在选项卡菜单的内部。但是,当我移至第二显示时,第二显示将显示,而没有选项卡菜单。

我选择了segue类型“ show(egPush)”

如何在所有视图上继续显示选项卡菜单?


阅读 407

收藏
2020-07-07

共1个答案

一尘不染

在界面生成器中:

  1. 创建一个UITabBarController并将其设置为初始View Controller。
  2. 创建一个UITableViewController
  3. 选择,UITableViewController然后转到menu bar > Editor > Embed in > Navigation Controller
  4. 选择您的,UITabBarController然后按住CTRL并将其拖到UINavigationController
  5. 选择Relationship Segue > view controllers
  6. 现在,您将添加到UINavigationController堆栈中的所有View Controller都将显示在same中UITabBarController

To perform a segue from the first-in-stack UITableViewController connected
to the UINavigationController, to another ViewController you must of course
first create another ViewController, create a segue to it in Interface Builder, create an identifier for your segue and in your code perform it by
calling the appropriate function in Swift like:

optional func performSegueWithIdentifier(_ identifier: String,
                                  sender sender: AnyObject?)

Here’s a sample on how your Interface Builder could look like: enter image
description here

2020-07-07