0

次のような子View Controllerがあります。

ここに画像の説明を入力

別の親View Controllerに埋め込んでいますが、

@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 で [Wants full screen] を選択する必要があります。そうしないと、上部に 20 ピクセルの空白が表示されます。

4

1 に答える 1

0

ストーリーボードで遊ぶのにうんざりしました。

だから私はWants Full Screenのチェックを外しました

そして以下を追加しました:

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

すべてが機能するようになりました

于 2013-03-30T00:14:04.823 に答える