title: Auto-layout XIB embedded in programmatic UIView not sizing to parent
body: <p>I have a xib file representing a simple view with auto-layout that I am instantiating with <code>[[NSBundle mainBundle] loadNibNamed:@"name"][0]</code> and adding to a programmatically-created <code>UIView</code> via <code>addSubview:</code>.</p>
  
  <p>The problem is that the view is not stretching to meet the size of the view it is embedded in; rather it appears to be defaulting to the size that was specified in the xib file. (I also can't find any way to set constraints on the container view itself in the xib file, only its subviews.)</p>
  
  <p>Also somewhat strangely, when I rotate the iPad, the view's width further shrinks proportionately. So it's clearly wired up somehow, but with the wrong initial values.</p>
  
  <p>What connection am I missing to get this embedded view to fit the view hierarchy properly?</p>
  
  <p>Screenshots (magenta colouring added for debugging):</p>
  
  <p><img src="https://i.stack.imgur.com/Bo58k.png" alt="screenshot 1"></p>
  
  <p>After rotating to portrait:</p>
  
  <p><img src="https://i.stack.imgur.com/JSh6d.png" alt="screenshot 2"></p>