title: How to take screenshot of a UIView in swift?
body: <p>I have a UIView named overView:</p>
  
  <pre><code>overView.frame = CGRectMake(self.view.frame.width/25, self.view.frame.height/25, self.view.frame.width/1.3, self.view.frame.height/1.2)
  </code></pre>
  
  <p>I want to take a screenshot of this view only and not my entire screen. And make the screenshot of size: </p>
  
  <pre><code> (CGSizeMake(2480,3508 )
  </code></pre>
  
  <p>Here is my code:</p>
  
  <pre><code>UIGraphicsBeginImageContextWithOptions(CGSizeMake(2480,3508 ), false, 0);
  self.view.drawViewHierarchyInRect(CGRectMake(-self.view.frame.width/25, -self.view.frame.height/25,2480,3508), afterScreenUpdates: true)
  var image:UIImage = UIGraphicsGetImageFromCurrentImageContext();
  UIGraphicsEndImageContext()
  </code></pre>
  
  <p>The screenshot is of the required size however it takes the screenshot of the entire view instead of just "overView".</p>