title: iOS - Find top constraint for a view?
body: <p>I am trying to find the top constraint of the view in code.
  The top constraint is added in storyboard, and I don't want to use an IBOutlet.</p>
  
  <p>Logging the value of the firstAttribute in the following code seems to always return a constraint of type NSLayoutAttributeHeight. Any idea how I could reliably find a top constraint of a view in code?</p>
  
  <pre><code>NSLayoutConstraint *topConstraint;
  
  for (NSLayoutConstraint *constraint in self.constraints) {
      if (constraint.firstAttribute == NSLayoutAttributeTop) {
          topConstraint = constraint;
          break;
      }
  }
  </code></pre>