title: UIImageView in UIScrollView not full-screen and pinch zooming
body: <p>Most of the sample code on the net assumes your UIScrollView will be full-screen.</p>
  
  <p>I'm trying to create a UIScrollView with just a UIImageView inside it, and just want to be able to pinch zoom as would normally happen. My UIScrollView only fills a part of the screen, so I can't just use autosizing to keep it the right size, as the sample applications seem to do. </p>
  
  <p>The closest I've got is to add this to the UIScrollViewDelegate:</p>
  
  <pre><code>- (void)scrollViewDidZoom:(UIScrollView *)scrollView {
  CGPoint cOffset = imageScrollView.contentOffset;
  float cScale = imageScrollView.contentScaleFactor;
  
  CGRect imageFrame = ptImage.frame;
  
  float scale = scrollView.zoomScale;
  
  imageFrame.size.width *= scale;
  imageFrame.size.height *= scale;
  
  ptImage.frame = imageFrame;
  
  scrollView.zoomScale = 1.0;
  scrollView.frame = CGRectMake(0.0, 0.0, scrollContainerView.frame.size.width, scrollContainerView.frame.size.height);
  scrollView.bounds = CGRectMake(cOffset.x * cScale * scale , cOffset.y * cScale * scale, scrollView.bounds.size.width, scrollView.bounds.size.height);
  
  scrollView.contentSize = imageFrame.size;
  </code></pre>
  
  <p>}</p>
  
  <p>The only problem here is that the bounds offset (scrollView.bounds = ...) is incorrect.</p>
  
  <p>Surely it's far simpler than I've done here?</p>
  
  <p>Any help?</p>