Created
December 8, 2013 20:36
-
-
Save chourobin/7863476 to your computer and use it in GitHub Desktop.
Screenshot of view controller
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 *)screenshot | |
| { | |
| CGRect rect = CGRectMake(0, 88.0, self.view.frame.size.width, self.view.frame.size.height - 88.0); | |
| UIGraphicsBeginImageContextWithOptions(rect.size, self.view.opaque, 0.0); | |
| CGContextRef context = UIGraphicsGetCurrentContext(); | |
| CGContextTranslateCTM(context, -rect.origin.x, -rect.origin.y); | |
| [self.view.layer renderInContext:context]; | |
| UIImage * img = UIGraphicsGetImageFromCurrentImageContext(); | |
| UIGraphicsEndImageContext(); | |
| return img; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment