title: Swift: How to set UIScrollView contentSize height to height of contents?
body: <p>I have a UIScrollView. Right now I am just setting it to double the height of the screen (frame in this case is just <code>UIScreen.mainScreen().bounds</code>):</p>
  
  <pre><code>class VenueDetailView: UIScrollView {
    required init?(coder aDecoder: NSCoder) { fatalError("Storyboard makes me sad.") }
  
    override init(frame: CGRect) {
      super.init(frame: frame)
      contentSize = CGSize(width: frame.width, height: frame.height*2) &lt;----------------
  
      backgroundColor = UIColor.greenColor()
    }
  
  
    func addBannerImage(imageUrl: NSURL) {
      let imageView = UIImageView(frame: CGRect(x: 0, y: 0, width: UIScreen.mainScreen().bounds.width, height: 300))
  
      // TODO: Make this asynchronous
      // Nice to have: cache the image
      if let data = NSData(contentsOfURL: imageUrl) {
        imageView.image = UIImage(data: data)
      }
  
      addSubview(imageView)
    }
  }
  </code></pre>
  
  <p>However, I just want it to be the size of all the contents inside it. How would I do this? Does this mean I have to set the <code>contentSize</code> after I add all the subviews?</p>