Skip to content

Instantly share code, notes, and snippets.

@yuanhao
Created January 4, 2015 13:57
Show Gist options
  • Select an option

  • Save yuanhao/fe336f1863bdfc189b1e to your computer and use it in GitHub Desktop.

Select an option

Save yuanhao/fe336f1863bdfc189b1e to your computer and use it in GitHub Desktop.
+ (UIImage *) imageWithView:(UIView *)view
{
UIGraphicsBeginImageContextWithOptions(view.bounds.size, view.opaque, 0.0f);
[view drawViewHierarchyInRect:view.bounds afterScreenUpdates:NO];
UIImage * snapshotImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return snapshotImage;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment