You can create three different ViewControllers in one storyboard file and give each the storyboard identifier. Do not bind them with segue. Then you drop the container where you want them to appear and delete the automatically created ViewController.
Then the following code works for me:
-(void)loadSubviewAtIndex:(NSUInteger)idx; { [self.subviewController.view removeFromSuperview]; [self.subviewController removeFromParentViewController]; NSString* subviewIdentifier = [self.subviewIdentifiers objectAtIndex:idx]; subviewController = [self.storyboard instantiateViewControllerWithIdentifier:subviewIdentifier]; CGRect frame = self.view.bounds; subviewController.view.frame = frame; [self.view addSubview:self.subviewController.view]; [self addChildViewController:self.subviewController]; }
Here, I assume that you have a subviewIdentifiers property, which is an NSArray and an implicit mapping of your segmented control index into a storyboard identifier, and an IBOutlet UIViewController* subviewController to which you bind the container view. Just call this method from a segmented control action.
source share