Last active
January 4, 2016 03:28
-
-
Save sebk/8561636 to your computer and use it in GitHub Desktop.
Add/Remove ChildViewController
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//add: | |
UIViewController *childVC = ...; | |
[childVC willMoveToParentViewController:self]; | |
[self addChildViewController:childVC]; | |
[self.view addSubview:childVC.view]; | |
//set frame or constraints of childVC.view | |
[childVC didMoveToParentViewController:self]; | |
//remove: | |
[childVC willMoveToParentViewController:nil]; | |
[childVC.view removeFromSuperview]; | |
[childVC removeFromParentViewController]; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment