You can use UIGraphicsBeginImageContextfor this purpose.
For instance:
UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, self.view.opaque, 0.0);
[self.myView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage*theImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
NSData*theImageData = UIImageJPEGRepresentation(theImage, 1.0 );
[theImageData writeToFile:@"example.jpeg" atomically:YES];
Here
1. First, I take the context of the image, I gave it how myView, which is a web view, you can provide whatever you want. It takes a web view image that can be seen on the screen.
2 Using UIGraphicsGetImageFromCurrentImageContext(), I will convert a screenshot of my web view into an image.
3. Using UIGraphicsEndImageContext(), I ask you to complete the context.
4. NSData, . NSData , .
EDIT: , :
UIImageWriteToSavedPhotosAlbum(theImage,nil,NULL,NULL); UIGraphicsEndImageContext();