title: Adding UIView to UIScrollView does not change content size?
body: <p>I'm adding a very large UIView to a UIScrollView, however the scroll view does not scroll to show the whole subview.</p>
  <p>When I add a label to the UIScrollView, it does scroll to show that label.</p>
  <p>On the actual project I'm working on, I added many views within the scrollView and it is not scrolling at all. This is a simplified example to show my problem:</p>
  <pre><code>import UIKit
  
  class ViewController: UIViewController {
      
      let scrollView: UIScrollView = {
          let scroll = UIScrollView()
          scroll.backgroundColor = .blue
          scroll.translatesAutoresizingMaskIntoConstraints = false
          return scroll
      }()
      
      let viewDoesntWork: UIView = {
          let view = UIView()
          view.backgroundColor = .purple
          view.translatesAutoresizingMaskIntoConstraints = false
          return view
      }()
      
      let labelWorks: UILabel = {
           let label = UILabel()
           label.text = &quot;Why this work?&quot;
           label.backgroundColor = .green
           label.translatesAutoresizingMaskIntoConstraints = false
           return label
       }()
      
      
      override func viewDidLoad() {
          super.viewDidLoad()
          view.backgroundColor = .red
          
          // Add scrollView to view, 20 from edges of view on all sides
          view.addSubview(scrollView)
          scrollView.leftAnchor.constraint(equalTo: view.leftAnchor, constant: 20).isActive = true
          scrollView.topAnchor.constraint(equalTo: view.topAnchor, constant: 20).isActive = true
          scrollView.rightAnchor.constraint(equalTo: view.rightAnchor, constant: -20).isActive = true
          scrollView.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: -20).isActive = true
          
          
          // OPTION 1 (does not work):
          // Add viewDoesntWork to view, make it much bigger than the scrollView fits
          scrollView.addSubview(viewDoesntWork)
          viewDoesntWork.topAnchor.constraint(equalTo: scrollView.topAnchor, constant: 20).isActive = true
          viewDoesntWork.leftAnchor.constraint(equalTo: scrollView.leftAnchor, constant: 20).isActive = true
          viewDoesntWork.widthAnchor.constraint(equalToConstant: 1000).isActive = true
          viewDoesntWork.heightAnchor.constraint(equalToConstant: 1000).isActive = true
          
          
          // OPTION 2 (works):
          // Add labelWorks to scrollView, and it does scroll to it. 
          // Uncomment this to see that work.
          // scrollView.addSubview(labelWorks)
          // labelWorks.topAnchor.constraint(equalTo: scrollView.topAnchor, constant: 1000).isActive = true
          // labelWorks.leftAnchor.constraint(equalTo: scrollView.leftAnchor, constant: 1000).isActive = true
          // labelWorks.rightAnchor.constraint(equalTo: scrollView.rightAnchor, constant: -20).isActive = true
          // labelWorks.bottomAnchor.constraint(equalTo: scrollView.bottomAnchor, constant: -20).isActive = true
  
      }
  }
  </code></pre>
  <p>As is, this does not scroll. But, if you comment out the specified section, it does.</p>
  <p>Why is this? How can it make it such that adding subViews to the scrollView makes it scroll?</p>
  <p>Thanks!</p>