title: ios 6: Center UILabel vertically using Auto Layout constraints
body: <p>I have a <code>UILabel</code> I sometimes want to center vertically in a cell. This has to be done programatically. I've tried adding the following constraint to center it (locName is the UILabel):</p>
  
  <pre><code>[cell addConstraint:[NSLayoutConstraint constraintWithItem:cell
  attribute:NSLayoutAttributeCenterY relatedBy:0 toItem:cell.locName 
  attribute:NSLayoutAttributeCenterY multiplier:1 constant:0]];
  </code></pre>
  
  <p>This is the result I get:</p>
  
  <p><img src="https://i.stack.imgur.com/G53RU.png" alt="enter image description here"></p>
  
  <p>It looks like its centering, but maybe changing the height of the <code>UILabel</code> or something?</p>
  
  <p>Here's the view controller in IB:</p>
  
  <p><img src="https://i.stack.imgur.com/yTMCl.png" alt="enter image description here"></p>
  
  <p>How can I achieve vertical centering programatically?</p>