title: Autoresize subviews when resizing the superview
body: <p>I am not able to handle the subview resizing correctly:</p>
  
  <p>Suppose I have a custom UIView class, inside it contains a UIImageView.</p>
  
  <p>Initially, I set up the UIViews like the followings:</p>
  
  <pre><code>// width and height are UIImage width height
  // it is possible that the UIImage width height is larger than the container
  
  self.imageView.frame = CGRectMake(0 ,0, width, height)
  self.imageView.backgroundColor = UIColor.redColor()
  self.imageView.contentMode = UIViewContentMode.ScaleAspectFit
  self.imageView.autoresizingMask = [.FlexibleWidth, .FlexibleHeight,.FlexibleTopMargin, .FlexibleLeftMargin, .FlexibleRightMargin, .FlexibleBottomMargin]
  addSubview(self.imageView)
  
  self.frame = CGRectMake(0, 0, width, height)
  self.backgroundColor = UIColor.greenColor()
  </code></pre>
  
  <p>Let's call this custom UIView as MyView.</p>
  
  <p>And then when I want to place this "myView" in a ViewController.  I did the followings:</p>
  
  <pre><code>myView.frame = CGRectMake(xPos, yPos, 100, 100)
  myView.autoResizeSubviews = true
  </code></pre>
  
  <p>And I found that after I did this, I got the following results.
  <a href="http://i.stack.imgur.com/BCK5B.png" rel="nofollow">MyView place at the correct place with correct size, but the internal UIImageView got even a smaller size.</a></p>
  
  <p>Why that happen? And how to make all the subviews inside MyView resize correctly according to the frame of MyView?</p>
  
  <p>Thanks.</p>