容器视图固定在屏幕的下半部分,在“按钮”上单击当前容器视图将替换为新的视图控制器。每个子视图的高度都不同。子视图滚动不起作用。我检查了很多答案,但找到了解决方案。代码是
UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]];
UIViewController *viewController = nil;
viewController = [storyBoard instantiateViewControllerWithIdentifier:@"First"];
// lets add it to container view
[viewController willMoveToParentViewController:self];
[self.containerViewController addSubview:viewController.view];
[self addChildViewController:viewController];
[viewController didMoveToParentViewController:self];