Search This Blog

Wednesday, 16 April 2014

iPhone Screenshot Programatically

Below is the method to take screenshot :

- (UIImage *) screenshot
{
    UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, NO, [UIScreen mainScreen].scale);
    
    [self.view drawViewHierarchyInRect:self.view.bounds afterScreenUpdates:YES];
    
    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return image;
}

No comments:

Post a Comment