user4951
user4951

Reputation: 33140

How to create an Outlet or reference from a viewController in storyboard to our controller?

I created an application that started with UITabBarController

Something like this:

enter image description here

Now I want to refer that that UITabBarController in the code. How am I supposed to do so?

Should I right drag to application delegate? (Doesn't work).

I could use instantiateViewControllerWithIdentfier: but I do not want to create a new UITabBarController. I want to refer to the existing one.

Upvotes: 0

Views: 352

Answers (1)

rdelmar
rdelmar

Reputation: 104092

Where in code do you want to refer to it? If it's one of the controllers that the tab bar controller manages, then you can use self.tabBarController. If it's from the appDelegate you can use self.window.rootViewController.

Upvotes: 1

Related Questions