Jump to content

4 posts in this topic

Recommended Posts

Posted

This helper class can take any UIView and return to you a UIImage that is basically 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;
}
×
  • Create New...

Important Information

We would like to place cookies on your device to help make this website better. The website cannot give you the best user experience without cookies. You can accept or decline our cookies. You may also adjust your cookie settings. Privacy Policy - Guidelines