title: Programmatically take a screenshot of specific area
body: <p>Like you can see in my code, I take a screenshot and save it to the photo album.</p>
  
  <pre><code>//for retina displays
  if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) {
      UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, NO, [UIScreen mainScreen].scale);
  } else {
      UIGraphicsBeginImageContext(self.view.bounds.size);
  }
  [self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
  UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
  UIGraphicsEndImageContext();
  UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil);
  </code></pre>
  
  <p>At the beginning I used <code>webview.size</code> instead of <code>self.view.bounds.size</code> and it was working properly because the view was located at <code>0/0</code>. But now I centered the WebView but the pictures is starts at <code>0/0</code> for the given size.</p>
  
  <p>How can I configure that the screenshot starts at another <code>location</code> (e.g. <code>300/150</code>) for the given size?</p>
  
  <p>Or is there another way to take a picture of an <code>UIWebView</code>?</p>