为什么苹果不允许在 Xib 中将一个 ViewController 添加到另一个中,尽管可以通过编程方式实现

Why apple does not allow addition of one ViewController into another in Xib, though it is possible programatically

在 Xib 中不允许这样做的任何原因。

-(void)addLeftViewController:(UIViewController *)viewController
{
    [self addChildViewController:viewController];
    [viewController.view setFrame:CGRectMake(0, 0, self.leftVw.frame.size.width, self.leftVw.frame.size.height)];
    [self.leftVw addSubview:viewController.view];
    [viewController didMoveToParentViewController:self];
}

您可以使用容器视图在故事板中轻松地做到这一点:

我发现这个link有用

How to add a subview that has its own UIViewController in Objective-C?