title: NSLayoutConstraint and "attach" two labels to each other
body: <p>I have two labels. I want to be able to move both if one is moved. How do I "attach" them together with NSLayoutConstraints? I can do this in IB, but need to do it in code.</p>
  
  <p>also, what are NSLayoutAttributeBaseline, NSLayoutAttributeLeading, and NSLayoutAttributeTrailing?</p>
  
  <p>EDIT:</p>
  
  <p>centering poweredByLabel (aka label02):</p>
  
  <pre><code>[constraints addObject:[NSLayoutConstraint constraintWithItem:poweredByLabel
                                                      attribute:NSLayoutAttributeCenterX
                                                      relatedBy:NSLayoutRelationEqual
                                                         toItem:myImage
                                                      attribute:NSLayoutAttributeCenterX
                                                     multiplier:1.0
                                                       constant:0]];
  </code></pre>
  
  <p>stack the labels and switch vertically:</p>
  
  <pre><code>[constraints addObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[rememberPasswordSwitch]-10-[rememberPasswordLabel]-10-[versionLabel]-[poweredByLabel]-|"
                                                                           options:NSLayoutFormatAlignAllBaseline
                                                                           metrics:nil
                                                                             views:viewsDictionary]];
  </code></pre>
  
  <p>which produces the error:</p>
  
  <blockquote>
    <p><em>*</em> Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unable to parse constraint
    format:  Options mask required views to be aligned on a vertical edge,
    which is not allowed for layout that is also vertical. 
    V:[rememberPasswordSwitch]-10-[rememberPasswordLabel]-10-[versionLabel]-[poweredByLabel]-|...........................................................................................................^'</p>
  </blockquote>
  
  <p>w/out the NSLayoutFormatAlignAllBaseline option, it runs fine (they stack but are not all centered horizontally).</p>