title: iOS Autolayout Vertically equal space to fill parent view
body: <p>I have a view controller with 12 <code>UITextField</code>s.</p>
  
  <p>It fits a 3.5" display very well.</p>
  
  <p><img src="https://i.stack.imgur.com/0DXL9m.png" alt="enter image description here"></p>
  
  <p>I need to set it for iPhone 5 (4 inch display) such that all <code>UITextField</code>s cover the whole <code>UIView</code> by adding extra space in between.</p>
  
  <p>I am trying to do this by auto layout but it is not working properly.</p>
  
  <p><img src="https://i.stack.imgur.com/IMjT2m.png" alt="enter image description here"></p>
  
  <p>This is my code :</p>
  
  <pre><code>- (void) viewWillLayoutSubviews
  {
      int h = txt1.bounds.size.height * 12;
  
      float unusedHorizontalSpace = self.view.bounds.size.height - h ;
  
      NSNumber* spaceBetweenEachButton=  [NSNumber numberWithFloat: unusedHorizontalSpace / 13 ] ;
  
      NSMutableArray *constraintsForButtons = [[NSMutableArray alloc] init];
  
      [constraintsForButtons addObjectsFromArray: [NSLayoutConstraint constraintsWithVisualFormat: @"V:|-50-[txt1(==30)]-(space)-[txt2(==txt1)]-(space)-[txt3(==txt1)]-(space)-[txt4(==txt1)]-(space)-[txt5(==txt1)]-(space)-[txt6(==txt1)]-(space)-[txt7(==txt1)]-(space)-[txt8(==txt1)]-(space)-[txt9(==txt1)]-(space)-[txt10(==txt1)]-(space)-[txt11(==txt1)]-(space)-[txt12]-(space)-|"
                                                                                          options: NSLayoutFormatAlignAllCenterX
                                                                                          metrics: @{@"space":spaceBetweenEachButton}
                                                                                            views: NSDictionaryOfVariableBindings(txt1,txt10,txt11,txt12,txt2,txt3,txt4,txt5,txt6, txt7,txt8,txt9)]];
  
      [self.view addConstraints:constraintsForButtons];
  }
  </code></pre>
  
  <p>If I do <code>[txt12(==txt1)]</code> then it displays the same as the 3.5" screen and leaves space below.</p>
  
  <p>Where I am making a mistake?</p>