Skip to content

Instantly share code, notes, and snippets.

@HarrisHan
Created October 29, 2016 02:51
Show Gist options
  • Save HarrisHan/b0cc76faaa9410146f961d4c81aa6360 to your computer and use it in GitHub Desktop.
Save HarrisHan/b0cc76faaa9410146f961d4c81aa6360 to your computer and use it in GitHub Desktop.
@implementation UIView (ScreenShot)
- (UIImage *)apo_screenshotImage
{
UIGraphicsBeginImageContextWithOptions(self.bounds.size, NO, 0.0);
[self drawViewHierarchyInRect:self.bounds afterScreenUpdates:NO];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment