title: UIScrollView autoresizemask is not working
body: <p>In my code which shown below, I am creating a scroll view and adding an Image View in it. Unfortunately autoresizingmask is not working and the image shown on a portion of the screen. The code is shown below:</p>
  
  <pre><code>// Scroll View Setup
  self.scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(10, 216, 300, 344)];
  self.scrollView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin);
  self.scrollView.delegate = self;
  self.scrollView.contentMode = UIViewContentModeScaleToFill;
  self.scrollView.scrollEnabled=YES;
  self.scrollView.userInteractionEnabled=YES;
  self.scrollView.bounces = YES;
  self.scrollView.bouncesZoom = YES;
  self.scrollView.delaysContentTouches = YES;
  self.scrollView.canCancelContentTouches = YES;
  self.scrollView.minimumZoomScale = 1;
  self.scrollView.maximumZoomScale = 10;
  self.scrollView.zoomScale = 1;
  self.scrollView.opaque = YES;
  self.scrollView.clipsToBounds = YES;
  self.scrollView.clearsContextBeforeDrawing = YES;
  self.scrollView.contentSize = CGSizeMake(300, 344);
  self.scrollView.autoresizesSubviews = YES;
  [self.view addSubview:self.scrollView];
  
  // Image View setup
  self.pgImage = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 300, 344)];
  self.pgImage.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin);
  self.pgImage.contentMode = UIViewContentModeScaleAspectFit;
  self.pgImage.opaque = YES;
  self.pgImage.clipsToBounds = NO;
  self.pgImage.clearsContextBeforeDrawing = YES;
  self.pgImage.autoresizesSubviews = YES;
  
  [self.scrollView addSubview:self.pgImage];
  
  //autoresize scrollView
  CGFloat scrollViewHeight = 0.0f;
  CGFloat scrollViewWidth = 0.0f;
  for (UIView *view in self.scrollView.subviews) {
      CGFloat height = (view.frame.size.height + view.frame.origin.y);
      scrollViewHeight = ((height &gt; scrollViewHeight) ? height : scrollViewHeight);
      CGFloat width = (view.frame.size.width + view.frame.origin.x);
      scrollViewWidth = ((width &gt; scrollViewWidth) ? width : scrollViewWidth);
  }
  
  [self.scrollView setContentSize:(CGSizeMake(scrollViewWidth, scrollViewHeight))];
  </code></pre>
  
  <p>For me it seams OK, but may be something is missing. Your assistance is welcomed. Thanking you in advance.</p>