user6825883 user6825883 - 3 years ago 166
iOS Question

Show Taps in TapBarViewController

I have a

with three Taps in my project.

Now I am trying to put a normal
in front of the
TapBar ViewController
when the application launches.

should have three buttons for one of the individual Taps of the

How can I show the individual Taps of the
by pressing one of the three buttons?


Answer Source

This is the exact answer you are looking for.


  1. Add a UIViewcontroller and embed with UINavigationViewController (Editor -> EmbedIn -> NavigationController).
  2. Add Three button + 1 Button (Navigate to TabViewController).
  3. Drag and drop UITabBarController to the storyboard it comes with one default ViewController and place a UILabel named as 'ButtonOneClicked'.
  4. Create Two more ViewControllers and named as 'ButtonTwoClicked' and 'ButtonThreeClicked'.
  5. Connect 'ButtonOne' with FirstViewController and set segue as Show and repeat the same for rest two.
  6. Click on each segue and provide an unique Identifier name.
  7. Then connect the UITabBarController with each UIViewController and choose viewcontrollers
  8. Create a ButtonAction to the Tab Button.
  9. Copy paste the below code in that action.

    @IBAction func tabClicked(_ sender: Any) {
        let appDelegate = UIApplication.shared.delegate as! AppDelegate
        appDelegate.window = UIWindow(frame: UIScreen.main.bounds)
        let storyboard = UIStoryboard(name: "Main", bundle: nil)
        let initialViewController = storyboard.instantiateViewController(withIdentifier: "Tab") as! UITabBarController
        appDelegate.window?.rootViewController = initialViewController

Please find the storyboard structure below

Hope this helps you!!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download