Jongers
Jongers

Reputation: 681

Steps in Referencing UITabBarController from StoryBoard to AppDelegate

I'm using a code that programmatically creates a UITabBarController in appDelegate. What I already have is a TabBarController created in the StoryBoard. I want to reference my TabBarController(from storyboard) to appDelegate and replace the UITabBarController which was programmatically created. How do I do that?

Upvotes: 0

Views: 68

Answers (1)

tutu_magi
tutu_magi

Reputation: 96

You can use the code below:

UIStoryboard *storyboard = [[UIStoryboard alloc] initWithStoryboard:[UIStoryboard storyboardWithName:@"YourStoryboardName" bundle:[NSBundle mainBundle]]];
UITabBarController *tabBarController = [storyboard instantiateViewControllerWithIdentifier:@"YourTabBarControllerIDInStroyboard"];

Upvotes: 2

Related Questions