iOS: 将 uiview 与其他 ViewController 视图拆分

iOS: split uiview with other ViewController view

我正在尝试制作类似 iPad 设置屏幕的东西,但是在我的控制器的子视图中..所以我不能使用 UISplitViewController

我制作了一个包含 2 个子视图的子视图,左边一个是 tablevew,右边一个是普通视图,用于子视图我想添加的控制器。

我正在为此使用此代码段

UIStoryboard*  sb = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
ViewController * vc  = [sb instantiateViewControllerWithIdentifier:@"vc"];
vc.view.frame = self.customView.bounds;
[self.customView addSubview:vc.view];

但它因错误而崩溃

tableView:cellForRowAtIndexPath:]: message sent to deallocated

在我启用僵尸对象后实例化

任何人都可以弄清楚为什么会发生这种情况,或者更好的是有一个开源组件可以做到这一点吗?

对于 contains a sub view controller.

的视图控制器,需要做一些额外的工作
UIStoryboard*  sb = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
ViewController * vc  = [sb instantiateViewControllerWithIdentifier:@"vc"];

[self addChildViewController:vc]; // Before adding the subview

vc.view.frame = self.customView.bounds;
[self.customView addSubview:vc.view];

[vc didMoveToParentViewController:self]; // After adding the subview