Created
October 30, 2013 18:03
-
-
Save nielswh/7237203 to your computer and use it in GitHub Desktop.
How to capture specific portion of the screen
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
| UIGraphicsBeginImageContext(self.view.bounds.size); | |
| [self.view.layer renderInContext:UIGraphicsGetCurrentContext()]; | |
| UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext(); | |
| UIGraphicsEndImageContext(); | |
| CGRect rect = CGRectMake(250,61 ,410, 255); | |
| CGImageRef imageRef = CGImageCreateWithImageInRect([viewImage CGImage], rect); | |
| UIImage *img = [UIImage imageWithCGImage:imageRef]; | |
| UIImageWriteToSavedPhotosAlbum(img, nil, nil, nil); | |
| CGImageRelease(imageRef); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment