To programmatically capture screen snapshots, you can:
#import <QuartzCore/QuartzCore.h>
- (void)saveScreenSnapshot:(UIView *)view
{
UIGraphicsBeginImageContext(view.frame.size);
[view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
// do what you want with this image; I frequently just drop it in the device's photo album
//
// UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil);
}
Alternatively, can get a PNG representation of that image
via:
NSData *data = UIImagePNGRepresentation(image);
You obviously have to add the QuartzCore.framework
to your target app's libraries.