0

I am working on application of greeting cards in I have taken screen shot and save in gallery so give any suggestion and source code which apply in my code

Barby Ashra
  • 101
  • 1
  • 4
  • Take a look at http://stackoverflow.com/questions/2214957/how-do-i-take-a-screen-shot-of-a-uiview – bdesham May 21 '12 at 14:31

1 Answers1

0

Like so:

- (UIImage *) captureScreen {
    UIWindow *keyWindow = [[UIApplication sharedApplication] keyWindow];
    CGRect rect = [keyWindow bounds];
    UIGraphicsBeginImageContext(rect.size);
    CGContextRef context = UIGraphicsGetCurrentContext();
    [keyWindow.layer renderInContext:context];   
    UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return img;
}

Then save the image to camera roll using the following tutorial http://mobiledevelopertips.com/camera/save-an-image-to-camera-roll.html

chewy
  • 8,207
  • 6
  • 42
  • 70