title: flexible width for UITextField in auto layout
body: <p>I've recently enabled Auto Layout in my client's app and am trying to update the program to take advantage of the iPhone 6 and 6 Plus larger screen sizes. However, I cannot get my view widths to adjust accordingly.</p>
  
  <p>At the moment, I'm just concerned with getting the top two views correct. Here's what it looks like:</p>
  
  <p><strong>UILabel  UITextField</strong></p>
  
  <p>The UILabel (called Name) has the following constraints:
  <strong><br>- Leading Space to Superview: 27
  <br>- Top Space to Superview: 24</strong></p>
  
  <p>The UITextField's constraints:
  <strong><br>- Leading Space to Name: 20
  <br>- Trailing Space to Superview: 27
  <br>- Align Center Y to Name</strong></p>
  
  <p>My hope was that this would position the left edge of the UITextField close to the Name label, and the right edge close to the right edge of the containing UIScrollView. However, while the left edge is correct, the UITextField is comically small, such that it could take no more than one or two characters.</p>
  
  <p>If I add a constraint to the UITextField <strong>Width >= 156</strong>, the field is wide enough for the small iPhones, but doesn't stretch far enough for the larger ones. It seems to completely ignore the Trailing Space to Superview constraint I placed on the UITextField.</p>
  
  <p>How can I get the UITextField to resize in accordance with the size of each device? Can I do it without resorting to code to change the constant of the Width constraint? Why is the Trailing Space to Superview constraint not respected?</p>
  
  <p>Thanks for any assistance.</p>
  
  <p><img src="https://i.stack.imgur.com/3pHb8.png" alt="enter image description here"></p>