Skip to content

Instantly share code, notes, and snippets.

@taberh
Created July 2, 2012 03:25
Show Gist options
  • Save taberh/3030819 to your computer and use it in GitHub Desktop.
Save taberh/3030819 to your computer and use it in GitHub Desktop.
get UIImage object in the UIView
+ (UIImage *)imageFromView:(UIView *)view
{
UIGraphicsBeginImageContext(view.frame.size);
CGContextRef context = UIGraphicsGetCurrentContext();
[view layer] renderInContext:context];
UIImage *image = UIGraphicsGetImageFromImageContext();
UIGraphicsEndImageContext();
return image;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment