Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save demigod19892012/5311131 to your computer and use it in GitHub Desktop.

Select an option

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
Copy Markdown

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