title: Setting UIScrollView zoom scale to fit the screen
body: <p>My point is to copy the behaviour of many apps which uses photos where when <code>UIScrollView</code> with <code>UIImageView</code> inside is being presented it fits image to the size of screen even if this image is smaller. </p>
  
  <p>I'm certain that this shouldn't be done with <code>UIImageView</code> frame but manipulated by <code>UIScrollView</code> but how...?</p>
  
  <hr>
  
  <p>In my code I have a method called <code>updateZoom</code> which calculates the <code>minimumZoomScale</code> value and also assigns this value to the <code>zoomScale</code> property. I guess that this is the right place to do math and calculate <code>zoomScale</code> manually.</p>
  
  <p>This is the method:</p>
  
  <pre><code>- (void)updateZoom {
      float minZoom = MIN(self.view.bounds.size.width / self.imageView.image.size.width, self.view.bounds.size.height / self.imageView.image.size.height);
  
      if (minZoom &gt; 1) {
          minZoom = 1;
      }
  
      self.scrollView.minimumZoomScale = minZoom;
      self.scrollView.zoomScale = minZoom;
  }
  </code></pre>
  
  <hr>
  
  <p>I hope that someone would give me a hit on <strong>how to set the <code>zoomScale</code> to fit the <code>UIScrollView</code> bounds.</strong></p>