title: Images loaded into a UIScrollview appearing in wrong size
body: <p>I am working on an app that loads images from a UIImagePickerController and loads them into a UIScrollview. Loading the images into the ScrollView works fine. However, the images will load at varying scales (code at bottom, images to demonstrate). The first image loaded by the application will load fine, but the second will be scaled down too small. Both are loaded through the same code block.</p>
  
  <p>First Load of an Image via UIImagePickerController:</p>
  
  <p><img src="https://i.stack.imgur.com/xOazF.png" alt="full sized image"></p>
  
  <p>Second Load of Same Image:</p>
  
  <p><img src="https://i.stack.imgur.com/5xtJL.png" alt="image loaded but doesnt fill view"></p>
  
  <p>This is the loadImage method, which they both are loaded through:</p>
  
  <pre><code>-(void)loadImage:(UIImage *)image
  {
          imageView.image = image;
      [imageScrollView setFrame: CGRectMake(0.0, 0.0, self.view.frame.size.width, self.view.frame.size.height)];
      [imageScrollView setDelegate:self];
  
      [imageScrollView setShowsHorizontalScrollIndicator:NO];
      [imageScrollView setShowsVerticalScrollIndicator:NO];
      [imageScrollView setMaximumZoomScale:2.0];
  
  
      CGRect rect;
      rect.size.width = imageView.image.size.width;
      rect.size.height = imageView.image.size.height;
      [imageView setFrame:rect];
  
      [imageScrollView setContentSize:[imageView frame].size];
  
      float minimumScale = [imageScrollView frame].size.width  / [imageView frame].size.width;
      [imageScrollView setMinimumZoomScale:minimumScale];
      [imageScrollView setZoomScale:minimumScale];
  
  }
  </code></pre>
  
  <p>Despite 4-5 hours of playing with and searching for answers to what should be a simple problem, I'm stumped. My own efforts don't change anything, and I haven't found an example of someone asking for help to this problem. What do I need to change in my code so that images always appear correctly the first time - that is, they appear scaled so that either the whole image shows, or (better) the images is fully on screen at the smallest dimension?</p>
  
  <p>Any help would be greatly appreciated!</p>