Skip to content

Instantly share code, notes, and snippets.

@congbo
Created August 31, 2015 01:09
Show Gist options
  • Save congbo/bdb31d1bbf8469805681 to your computer and use it in GitHub Desktop.
Save congbo/bdb31d1bbf8469805681 to your computer and use it in GitHub Desktop.
UIView 转 UIImage
- (UIImage *) imageWithUIView:(UIView *)view {
UIGraphicsBeginImageContextWithOptions(view.bounds.size, NO, [UIScreen mainScreen].scale);
[view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage * image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment