How to add a Container View programmatically

A storyboard “container view” is just a standard UIView object. There is no special “container view” type. In fact, if you look at the view hierarchy, you can see that the “container view” is a standard UIView: To achieve this programmatically, you employ “view controller containment”: Instantiate the child view controller by calling instantiateViewController(withIdentifier:) on … Read more

Access Container View Controller from Parent iOS

Yes, you can use the segue to get access the child view controller (and its view and subviews). Give the segue an identifier (such as alertview_embed), using the Attributes inspector in Storyboard. Then have the parent view controller (the one housing the container view) implement a method like this: – (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { … Read more