Segue to another storyboard?

Ry- picture Ry- · Mar 6, 2012 · Viewed 52.1k times · Source

Is it possible to segue from one storyboard to another, or to embed a storyboard in a view controller in another storyboard? I need to place a UITabBarController in a UINavigationController, and I'd like to keep them nice and separate.

Answer

lnafziger picture lnafziger · Mar 8, 2012

Yes, but you have to do it programmatically:

// Get the storyboard named secondStoryBoard from the main bundle:
UIStoryboard *secondStoryBoard = [UIStoryboard storyboardWithName:@"secondStoryBoard" bundle:nil];

// Load the initial view controller from the storyboard.
// Set this by selecting 'Is Initial View Controller' on the appropriate view controller in the storyboard.
UIViewController *theInitialViewController = [secondStoryBoard instantiateInitialViewController];
//
// **OR**  
//
// Load the view controller with the identifier string myTabBar
// Change UIViewController to the appropriate class
UIViewController *theTabBar = (UIViewController *)[secondStoryBoard instantiateViewControllerWithIdentifier:@"myTabBar"];

// Then push the new view controller in the usual way:
[self.navigationController pushViewController:theTabBar animated:YES];