Last active
February 13, 2018 09:42
-
-
Save fmessina/90eda235c4a71f686d2862ba576c1832 to your computer and use it in GitHub Desktop.
Adding and removing a view controller on top of another - on iOS - without using modal presentation
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
// GOAL | |
// viewControllerA | |
// |_ viewControllerB | |
UIViewController *viewControllerA = ...; | |
UIViewController *viewControllerB = ...; | |
// Adding | |
[viewControllerA addChildViewController:viewControllerB]; | |
[viewControllerA.view addSubview:viewControllerB.view]; | |
// Removing | |
[viewControllerB willMoveToParentViewController:nil]; | |
[viewControllerB.view removeFromSuperview]; | |
[viewControllerB removeFromParentViewController]; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment