Addingremoving a child view controller

suggest change

To add a child view controller:

- (void)displayContentController:(UIViewController *)vc {
   [self addChildViewController:vc];
   vc.view.frame = self.view.frame;
   [self.view addSubview:vc.view];
   [vc didMoveToParentViewController:self];
}

To remove a child view controller:

- (void)hideContentController:(UIViewController *)vc {
   [vc willMoveToParentViewController:nil];
   [vc.view removeFromSuperview];
   [vc removeFromParentViewController];
}

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents