title: UIImage in UIScrollView loads zoomed, rather than aspect fit
body: <p>I am using Xcode 6.4 and writing in swift. </p>
  
  <p>Right now I am trying to display a simple image in aspect fit and then be able to zoom in. Unfortunately the image loads fully zoomed. Everything else works just fine, double tapping even results in seeing the image aspect fit. How could I change my code so that the image loads in aspect fit? </p>
  
  <p>My case is very similar to </p>
  
  <p><a href="https://stackoverflow.com/questions/6161786/uiimage-is-not-fitting-in-uiscrollview-at-start/6162310#6162310">UIImage Is Not Fitting In UIScrollView At Start</a></p>
  
  <p>However, the objective-c answer no longer works.</p>
  
  <p>Here is my code for viewDidLoad</p>
  
  <pre><code>override func viewDidLoad() {
      super.viewDidLoad()
  
      imageView = UIImageView(image: UIImage(named: "image.png"))
  
      scrollView = UIScrollView(frame: view.bounds)
      scrollView.backgroundColor = UIColor.blackColor()
      scrollView.contentSize = imageView.bounds.size
      scrollView.autoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight
      scrollView.contentOffset = CGPoint(x: 1000, y: 450)
  
      scrollView.addSubview(imageView)
      view.addSubview(scrollView)
  
      scrollView.delegate = self
  
      setZoomScale()
      setupGestureRecognizer()
  }
  </code></pre>
  
  <p>And here is my code for setZoomScale()</p>
  
  <pre><code>    func setZoomScale() {
      let imageViewSize = imageView.bounds.size
      let scrollViewSize = scrollView.bounds.size
      let widthScale = scrollViewSize.width / imageViewSize.width
      let heightScale = scrollViewSize.height / imageViewSize.height
  
      scrollView.minimumZoomScale = min(widthScale, heightScale)
      scrollView.zoomScale = 1.0
  }
  </code></pre>
  
  <p>All this originates from the online tutorial, </p>
  
  <p><a href="http://www.appcoda.com/uiscrollview-introduction/" rel="nofollow">http://www.appcoda.com/uiscrollview-introduction/</a></p>
  
  <p>Thank you in advance!</p>