Hi guys,
I'm looking for a way to write the contents of the screen to an image. Any idea how to achieve that? Does it involve using Quartz?
Thanks
Hi guys,
I'm looking for a way to write the contents of the screen to an image. Any idea how to achieve that? Does it involve using Quartz?
Thanks
In a nutshell:
CGImageRef screen = UIGetScreenImage();
UIImage *screenImage = [UIImage imageWithCGImage:screen];
Add this code to your UIViewController to create a screen dump of its UIView.
// create screen dump of the view of this view controller
UIGraphicsBeginImageContext(self.view.bounds.size);
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *screenShot = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
// save image to photos
UIImageWriteToSavedPhotosAlbum(screenShot, self, nil, nil);