Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
427 views
in Technique[技术] by (71.8m points)

ios - How to use Navigation Controller inside of UITabBarController with Storyboard on Swift

enter image description hereI'm using swift. I would like to use Navigation inside of TabBar with Storyboard. At first, the first display show up inside of tab menu. But when I move to second display, second display show up without tab menu.

I selected segue type "show (e.g.Push)"

How can I keep displaying tab menu on all views?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

In Interface Builder:

  1. Create an UITabBarController and set it as the initial View Controller.
  2. Create an UITableViewController.
  3. Select the UITableViewController and go to the menu bar > Editor > Embed in > Navigation Controller.
  4. Select your UITabBarController and CTRL-drag from it to the UINavigationController.
  5. Choose Relationship Segue > view controllers.
  6. Now, any View Controller you will add in the UINavigationController stack will be presented in the 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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...