title: imageView centered inside scrollView
body: <p>How can I vertically center an image inside a scrollView?</p>
  
  <p>I'm using storyboards in Xcode 5. The main view is embedded inside a navigation controller, and "Adjust scroll view insets" option is enabled in main Storyboard. This main view has a scrollView which size is equal to the main view size.</p>
  
  <p>The imageView is inside the scrollView and it's the same size as the scrollView. Content mode is set to AspectFit.</p>
  
  <p>So, hierarchy is as follows:</p>
  
  <pre><code>- UINavigationController
  - UIView
     - UIScrollView
         - UIImageView
  </code></pre>
  
  <p>The image may be landscape or portrait, and can be any size (it's loaded at runtime). This is why imageView is the same size as the scrollView.</p>
  
  <p>How can I vertically center the image inside the scrollView?</p>
  
  <p><strong>EDIT:</strong>
  As commented before, I have set imageView's contentMode to AspectFit because the image may be too big, so I need it resized. The problem I have is that the image is not center of the scrollView.</p>
  
  <p>You can check screenshot at <a href="http://www.ajgm.mx/images/screenshot.png" rel="nofollow">link</a> and download source code at <a href="http://www.ajgm.mx/downloads/ImageCenteredOnScrollView.zip" rel="nofollow">link</a>.</p>