0

我有一个看起来像这样的子视图控制器:

在此处输入图像描述

我将它嵌入到另一个父视图控制器中,

@implementation ContainmentViewController

- (id)initWithCoder:(NSCoder *)decoder {
    if(self = [super initWithCoder:decoder]) {
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];

    self.prototypeVC = [self.storyboard instantiateViewControllerWithIdentifier:@"PrototypeViewController"];

    [self addChildViewController:self.prototypeVC];
    [self.view addSubview:self.prototypeVC.view];
    [self.prototypeVC didMoveToParentViewController:self];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

这就是它在原始子 VC 中的样子:;

在此处输入图像描述

这是它在 ContainmentVC 中的样子:

在此处输入图像描述

我究竟做错了什么?

注意:我必须在 ChildVC 上选择“想要全屏”,否则我会在顶部看到 20 像素的空白区域。

4

1 回答 1

0

I got fed up with playing with storyboard.

So I unchecked Wants Full Screen

and added the following:

self.prototypeVC.view.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);

Everything works now

于 2013-03-30T00:14:04.823 回答