Segue to another storyboard? Segue to another storyboard? ios ios

Segue to another storyboard?


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 classUIViewController *theTabBar = (UIViewController *)[secondStoryBoard instantiateViewControllerWithIdentifier:@"myTabBar"];// Then push the new view controller in the usual way:[self.navigationController pushViewController:theTabBar animated:YES];


From Xcode 7 onwards, you can do this graphically by using a Storyboard Reference:

reference

Add Storyboard Reference to your storyboard. Create segue between ViewController and Storyboard Reference (ctrl + drag)

Then fill this fields.

enter image description here

Where "Tutorial" is "Tutorial.storyboard" fileand "MainTutorialController" is your "Storyboard ID" field in ViewControllerSettings


You can't really do segues manually because UIStoryboardSegue is an abstract class. You need to subclass it and implement perform in order for it to do anything. They're really meant to be created in storyboards. You can push the view controller manually, though, which is a good solution. lnafziger's answer does this well:

UIStoryboard *secondStoryBoard = [UIStoryboard storyboardWithName:@"secondStoryBoard" bundle:nil];UIViewController *theTabBar = [secondStoryBoard instantiateViewControllerWithIdentifier:@"myTabBar"];[self.navigationController pushViewController:theTabBar animated:YES];

One thing to note, though, is that you've said you want to keep things nice and separate. The idea of storyboards is to allow you to keep things separate while doing all of your design work in one place. Each view controller is nice and separated within the storyboard from the others. The whole idea is to keep it all in one place. Just lay it out nicely so that it's organized, and you'll be good to go. You shouldn't separate it unless you have a really good reason to do so.