title: Horizontal autolayout constraint has some strange offset on UIScrollView/UIView
body: <p>Last week I dived into auto layout. While coding my first app today, I faced a strange "bug" with UIScrollView and auto layout. I couldn't find any similar issue on here so I created a new topic.</p>
  
  <p>Here is some example code:</p>
  
  <pre><code>    self.view.backgroundColor = UIColor.greenColor()
  
      let view = UIScrollView()
      view.setTranslatesAutoresizingMaskIntoConstraints(false)
      view.backgroundColor = UIColor.redColor()
      self.view.addSubview(view)
  
      let constraintH = NSLayoutConstraint.constraintsWithVisualFormat("H:|-[view]-|", options: NSLayoutFormatOptions(0), metrics: nil, views: ["view": view])
  
      // two options fixing this bug: "H:|-0-[view]-0-|" or "H:|[view]|"
      // only horizontal constraint has this issue
  
      let constraintV = NSLayoutConstraint.constraintsWithVisualFormat("V:|-[view]-|", options: NSLayoutFormatOptions(0), metrics: nil, views: ["view": view])
  
      self.view.addConstraints(constraintH)
      self.view.addConstraints(constraintV)
  </code></pre>
  
  <p>First I thought the reason was iOS 8.3 Beta SDK, but issue is also present with iOS 8.1 SDK. So is it only me or is it some autolayout bug which I should report to Apple?</p>
  
  <p><strong>UPDATE:</strong>
  I modified the code from UIScrollView to UIView so you can see that this bug is also applied to a normal UIView as well.</p>
  
  <p><a href="https://i.stack.imgur.com/MDKfI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MDKfI.png" alt="enter image description here"></a>
  </p>