Ios – Linking child view controllers to a parent view controller within storyboard

cocoa-touchiosuistoryboarduiviewcontrollerxcode

Can you associate child view controllers to a custom container view controller in Storyboard?

I can link child view controllers to a tab view controller, and I can link one view controller to a navigation controller.

What must I do to the container VC to accept child VCs?

Best Answer

As something of a combo of Caleb and Matt's answers, I did:

-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    if ([segue.identifier isEqualToString:@"cpdc_check_embed"]) {
        self.checkVC = segue.destinationViewController;
    }
}

...where checkVC is a property on the container controller:

@property (weak,nonatomic) PXPCheckViewController * checkVC;

You just have to set your embed segue's Storyboard ID to whatever you want (in this case, cpdc_check_embed):

check embed screen in Xcode

...and then check the identifier in -prepareForSegue:sender:.

Still not an outlet, but cleaner than Matt's (IMHO) and more specific than Caleb's, and you still get a nice-looking storyboard:

enter image description here