Created
April 2, 2015 15:01
-
-
Save remirobert/236778b711b352c17b51 to your computer and use it in GitHub Desktop.
create a 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*)getScreenShot:(UIView*)view { | |
CGRect screenRect = [[UIScreen mainScreen] bounds]; | |
UIGraphicsBeginImageContext(screenRect.size); | |
CGContextRef ctx = UIGraphicsGetCurrentContext(); | |
[[UIColor blackColor] set]; | |
CGContextFillRect(ctx, screenRect); | |
[view.layer renderInContext:ctx]; | |
UIImage *screenImage = UIGraphicsGetImageFromCurrentImageContext(); | |
UIGraphicsEndImageContext(); | |
return screenImage; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment