Container View Controller

有时候,我们的Controler中包含有另一个controler view的view时,可以使用这种方式。

https://developer.apple.com/library/ios/featuredarticles/ViewControllerPGforiPhoneOS/ImplementingaContainerViewController.html

把一个controller view 加入到 controler中

 [self addChildViewController:content];  //1
 content.view.frame = [self frameForContentController]; 
 [self.view addSubview:self.currentClientView]; //2
 [content didMoveToParentViewController:self]; //3

移除一个controller view

 [content willMoveToParentViewController:nil]; //1
 [content.view removeFromSuperview]; //2
 [content removeFromParentViewController]; //3

  

 

你可能感兴趣的:(Container View Controller)