Last active
January 15, 2022 02:18
-
-
Save danie7k/d423b0d471281ebb71d7be441f8b497c to your computer and use it in GitHub Desktop.
iOS Objective-C screenshot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (UIImage *)snapshot:(UIView *)view | |
{ | |
UIGraphicsBeginImageContextWithOptions(view.bounds.size, YES, 0); | |
[view drawViewHierarchyInRect:view.bounds afterScreenUpdates:YES]; | |
UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); | |
UIGraphicsEndImageContext(); | |
return image; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment