Created
November 18, 2018 11:45
-
-
Save candostdagdeviren/cf2a84ec4368864d2a45567995d8bad1 to your computer and use it in GitHub Desktop.
View Lifecycle - NS for iOS Devs
This file contains hidden or 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
// Adding a view controller to another | |
let childViewController = UIViewController() | |
let parentViewController = UIViewController() | |
parentViewController.addChild(childViewController) | |
parentViewController.view.addSubview(childViewController.view) | |
// setup auto-layout constraints for childViewController.view | |
childViewController.didMove(toParent: parentViewController) | |
// Removing the child view controller from parent | |
childViewController.willMove(toParent: nil) | |
childViewController.view.removeFromSuperview() | |
childViewController.removeFromParent() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment