I am taking a screenshot of a certain kind in my Xib file with the following code ...
UIView* captureView = self.view;
UIGraphicsBeginImageContextWithOptions(captureView.bounds.size, NO , 0.0f);
[captureView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage * screenshot = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil);
It works great and saves a jpg image in a camera roll.
But the problem is that at the top of my view there is another UIImageView, which UIImageView has a translucent image in it. My screenshot does not preserve this transparency in the screenshot. I want to maintain transparency, as on a real screen.
How to maintain transparency in the screenshot?
source
share