Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save demigod19892012/5311131 to your computer and use it in GitHub Desktop.
Save demigod19892012/5311131 to your computer and use it in GitHub Desktop.
[IOS] How to capture UIView to UIImage
+ (UIImage *) imageWithView:(UIView *)view
{
UIGraphicsBeginImageContextWithOptions(view.bounds.size, view.opaque, 0.0);
[view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage * img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return img;
}
@monxarat
Copy link

This code can't save UIView has Using transform 3d.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment