0

I have a child view controller looking like this:

enter image description here

I am embedding it into another parent 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.
}

This is how it should look like in the original child VC:;

enter image description here

This is how it looks like in the ContainmentVC:

enter image description here

What am I doing wrong?

NOTE: I have to pick "Wants full screen" on the ChildVC otherwise I will see a 20px white space at the top.

xjq233p_1
  • 7,810
  • 11
  • 61
  • 107

1 Answers1

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

xjq233p_1
  • 7,810
  • 11
  • 61
  • 107