title: Fastest way to take screenShot of UIView
body: <p>I've searched a lot but only found two methods to take screen shot of UIView.
  first <code>renderInContext:</code>
  I've used it in a way</p>
  
  <pre><code>CGContextRef context = [self createBitmapContextOfSize:CGSizeMake(nImageWidth, nImageHeight)];
  CGAffineTransform flipVertical = CGAffineTransformMake(1, 0, 0, -1, 0, nImageHeight);
  CGContextConcatCTM(context, flipVertical);
  [self.layer setBackgroundColor:[UIColor clearColor].CGColor];
  [self.layer renderInContext:context];
  CGImageRef cgImage = CGBitmapContextCreateImage(context);
  UIImage* background = [UIImage imageWithCGImage: cgImage];
  CGImageRelease(cgImage);
  </code></pre>
  
  <p>Second <code>drawViewHierarchyInRect:</code> which I've used as</p>
  
  <pre><code>UIImage *background = nil;
  
  UIGraphicsBeginImageContextWithOptions (self.bounds.size, NO, self.window.screen.scale);
  
  if ([self respondsToSelector:@selector(drawViewHierarchyInRect:afterScreenUpdates:)])
  {
      [self drawViewHierarchyInRect:self.bounds afterScreenUpdates:YES];   
  }
  background = UIGraphicsGetImageFromCurrentImageContext();
  
  UIGraphicsEndImageContext();
  </code></pre>
  
  <p>I know that the second one is faster than first and it work for me for iPhone because the view has low size. but when I capturing from iPad the video become jerky. 
  Can Any body tell me faster way of taking screen shot.
  any help would be highly appreciated </p>