Tuesday 22 January 2013

Screen Shot

Screen Shot
-(IBAction)screenShot:(id)sender
{
          CGRect screenRect = [[UIScreen mainScreen] bounds];
    UIGraphicsBeginImageContext(screenRect.size);
    CGContextRef ctx = UIGraphicsGetCurrentContext();
    [[UIColor blackColor] set];
    CGContextFillRect(ctx, screenRect);
    [self.view.layer renderInContext:ctx];
  UIImage *screenImage =         UIGraphicsGetImageFromCurrentImageContext();
    UIImageWriteToSavedPhotosAlbum(screenImage, nil, nil, nil);
    UIGraphicsEndImageContext();
}

No comments:

Post a Comment