title: Custom View - self.frame is not correct?
body: <p>So I have a custom UIView class</p>
  
  <pre><code>class MessageBox: UIView {
      override init(frame: CGRect) {
          super.init(frame: frame)
          createSubViews()
      }
      required init?(coder aDecoder: NSCoder) {
          super.init(coder: aDecoder)
          createSubViews()
      }
      func createSubViews() {
  
          let testView = UIView(frame: self.frame)
          testView.backgroundColor = UIColor.brown
          self.addSubview(testView)
      }
  }
  </code></pre>
  
  <p>I added a UIView inside the storyboard and gave it some constraints:</p>
  
  <blockquote>
    <p>100 from the top (superview), 0 from the left and right, height is 180</p>
  </blockquote>
  
  <p>But when I run the app the brown subview I created in the code is way to big. I printed <code>self.frame</code> in my custom view and it turns out that the frame is <code>(0,0,1000,1000)</code>. But why? I set constraints, it should be something like <code>(0,0,deviceWith, 180)</code>.</p>
  
  <p><a href="https://i.stack.imgur.com/6BH5s.png" rel="noreferrer"><img src="https://i.stack.imgur.com/6BH5s.png" alt="enter image description here"></a></p>
  
  <p>What did I do wrong?</p>
  
  <p>EDIT: That's my Storyboard setup:</p>
  
  <p><a href="https://i.stack.imgur.com/gXHj2.png" rel="noreferrer"><img src="https://i.stack.imgur.com/gXHj2.png" alt="enter image description here"></a></p>