Skip to content

Instantly share code, notes, and snippets.

@adriantofan
Created March 6, 2015 08:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adriantofan/23d01c97a9f47f722495 to your computer and use it in GitHub Desktop.
Save adriantofan/23d01c97a9f47f722495 to your computer and use it in GitHub Desktop.
add/remove childviewcontroller
[self addChildViewController:vc];
// [vc willMoveToParentViewController:self] called automatically
[self.view addSubview:vc.view]; // or something like this.
[vc didMoveToParentViewController:self];
// For removing view controllers:
[vc willMoveToParentViewController:nil];
[vc.view removeFromSuperview]; // or something like this
[vc removeFromParentViewController];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment