title: Frames vs Bounds and autolayout constraints?
body: <p>I recently read a wonderful question regarding frames &amp; bounds property of views over here - <a href="https://stackoverflow.com/q/5361369/5395919">UIView frame, bounds and center</a>. I tried to experiment on that a bit more with autolayout as well and now I find myself in a very conflicting scenario. Please be patient as it may take a bit long.</p>
  
  <p>I will highlight them one by one &amp; so please help me to get over all these - </p>
  
  <p><strong>What I have? -</strong></p>
  
  <p><em>A view hierachy with constraints as follows -</em>
  (The designing was done on the default ViewController size of 600*600)</p>
  
  <p><a href="https://i.stack.imgur.com/WvUhe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WvUhe.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/fzHrz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fzHrz.png" alt="enter image description here"></a></p>
  
  <p><strong>I tried to print out the frames and bounds of these views -</strong> </p>
  
  <p><strong>contentView</strong></p>
  
  <pre><code> print(contentView.frame)// o/p - (0.0, 64.0, 600.0, 536.0) 
    print(contentView.bounds)//o/p- (0.0, 0.0, 600.0, 536.0)
  </code></pre>
  
  <p><strong>Q)</strong> **a)**Why is the frame size showing 600*536 whichever screen I may run it. eg. It prints the same if I run it on a 4s screen or else in an iPad screen? </p>
  
  <p>**b)**And it always infers the size of my VC in my storyboard!!. eg. If i design the screen in a 3.5 inch VC,the frame size becomes 320.0*416.0.</p>
  
  <p>**c)**Since it is pinned to all sides of the view it should be same to the view size, and also it always remains pinned to edges. So why is it not of the same size of <code>self.view.frame.width*self.view.frame.height</code></p>
  
  <p><strong>sideView</strong>     </p>
  
  <pre><code>print(sideView.frame)//o/p - (520.0, 86.0, 80.0, 128.0) 
     print(sideView.bounds)//o/p - (0,0, 80.0, 128.0)
  </code></pre>
  
  <p><strong>Q)</strong> If I design a custom UIView programmatically as</p>
  
  <pre><code>let TestView = UIView(frame: CGRectMake(520.0, 86.0, 80.0, 128.0))//Mark:its frame is exactly same as sideView.frame
          TestView.backgroundColor = UIColor.redColor()
          self.contentView.addSubview(TestView)
  </code></pre>
  
  <p>So here the sideView(subview of contentView) should be replaced by the TestView but isn't &amp; the o/p screen comes the same as in previous case. Why?</p>
  
  <p>Thanks.</p>