This helper class can take any uiview and return to you a uiimage that is basicly a screenshot of that view. Throw this into a category and you’re good to go.

+ (UIImage*)viewAsImage:(UIView*)view {
	UIImage *image = nil;
	UIGraphicsBeginImageContextWithOptions(view.bounds.size, NO, [UIScreen mainScreen].scale);
	[view.layer renderInContext:UIGraphicsGetCurrentContext()];
	image = UIGraphicsGetImageFromCurrentImageContext();
	UIGraphicsEndImageContext();
    
	return image;
}

Leave a Reply

Your email address will not be published. Required fields are marked *