Skip to content

Instantly share code, notes, and snippets.

@ltomaszewski
Forked from tomohisa/gist:2897676
Last active August 29, 2015 14:10
Show Gist options
  • Save ltomaszewski/ad0b911f8a0f64a68def to your computer and use it in GitHub Desktop.
Save ltomaszewski/ad0b911f8a0f64a68def to your computer and use it in GitHub Desktop.

Revisions

  1. @tomohisa tomohisa created this gist Jun 8, 2012.
    11 changes: 11 additions & 0 deletions gistfile1.m
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    // add child view
    UIViewController* controller = [self.storyboard instantiateViewControllerWithIdentifier:@"test"];
    [self addChildViewController:controller];
    controller.view.frame = CGRectMake(0, 44, 320, 320);
    [self.view addSubview:controller.view];
    [controller didMoveToParentViewController:self];

    // remove child view
    UIViewController *vc = [self.childViewControllers lastObject];
    [vc.view removeFromSuperview];
    [vc removeFromParentViewController];