On iphone, is it possible to "screen capture" an UIView and all its subview? If it is possible, how?
After pressing the Home and the Power button simultaneously, instead of taking a screenshot of your whole screen right away, the screen grays out allowing you to drag onto it to choose a specific portion which you want to take a screenshot of. After raising your finger, the screenshot will be saved to the Camera Roll.
Also, you can press Ctrl+Shift+P on Windows or Command+Shift+P on Mac. Type screenshot into the search box. Select Capture full-size screenshot.
I found this, but I haven't tried it myself.
Here you find the used  -renderInContext. 
I transformed the code above to a category on UIView.
call  it like this: [aView saveScreenshotToPhotosAlbum];
#import <QuartzCore/QuartzCore.h>
- (UIImage*)captureView {
    CGRect rect = [[UIScreen mainScreen] bounds];  
    UIGraphicsBeginImageContext(rect.size);     
    CGContextRef context = UIGraphicsGetCurrentContext();  
    [self.layer renderInContext:context];  
    UIImage *img = UIGraphicsGetImageFromCurrentImageContext();  
    UIGraphicsEndImageContext();  
    return img;
}
- (void)saveScreenshotToPhotosAlbum {
    UIImageWriteToSavedPhotosAlbum([self captureView], nil, nil, nil);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With