title: How Do I Take a Screen Shot of a UIView?
body: <p>I am wondering how my iPhone app can take a screen shot of a specific <code>UIView</code> as a <code>UIImage</code>.</p>
  
  <p>I tried this code but all I get is a blank image.</p>
  
  <pre><code>UIGraphicsBeginImageContext(CGSizeMake(320,480));
  CGContextRef context = UIGraphicsGetCurrentContext();
  [myUIView.layer drawInContext:context];
  UIImage *screenShot = UIGraphicsGetImageFromCurrentImageContext();
  UIGraphicsEndImageContext();
  </code></pre>
  
  <p><code>myUIView</code> has dimensions 320x480 an it has some sub-views.
  What is the correct way to do this?</p>