+ (UIImage *)takeScreenshot:(UIView *)theView
{
// Use UIGraphicsBeginImageContext(CGSize size) if targetting < iOS 4.0
UIGraphicsBeginImageContextWithOptions(theView.bounds.size, NO, 0.0);
[theView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *screenshot = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return screenshot;
}