AlexanderHart
AlexanderHart

Reputation: 77

UINavigation Controller inside Tab Bar Controller Issue

My current storyboard looks like the following: Click here to see screenshot

The problem is that I don't know what relationship the "Login View Controller" should have with the other views. As a result, when I build the project - "View Controller" comes up as a black void, Click here to see what I mean.

Upvotes: 0

Views: 43

Answers (1)

Akshansh Thakur
Akshansh Thakur

Reputation: 5341

Click on your tabBarController and type in an identifier, say yourVCID

enter image description here

You can then reach your view controllers like so:

let controller = self.storyboard!.instantiateViewControllerWithIdentifier("yourVCID") as! UITabBarController

// Above line will give you the address(reference) to the View controller that has an id "yourVCID". This is where you want to go. here self is the Login View Controller(from where you want to go). StoryBoard is the storyboard that contains the view Controller represented by self.

self.presentViewController(controller, animated: true, completion: nil)

// Above line will present the controller and this controller will originate from self (Login View Controller) in this case

This will automatically present the Home screen (View Controller) of your Tab bar controller

Upvotes: 1

Related Questions