Created
July 7, 2015 18:20
-
-
Save ivangodfather/9b49b6dc1ebf8a5e49e7 to your computer and use it in GitHub Desktop.
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
| var childVC: UIViewController? | |
| @IBOutlet weak var containerView: UIView! | |
| func ChangeViewController() { | |
| childVC?.willMoveToParentViewController(nil) | |
| childVC?.view.removeFromSuperview() | |
| childVC?.removeFromParentViewController() | |
| childVC = storyboard?.instantiateViewControllerWithIdentifier("identifier") as? UIViewController | |
| if let childVC = childVC { | |
| addChildViewController(childVC) | |
| childVC.view.frame = containerView.bounds | |
| containerView.addSubview(childVC.view) | |
| childVC.didMoveToParentViewController(self) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment