IPhone Screenshots

I use UIGetScreenImage () to get a screenshot of the UIImagePickerController. I mainly use camera overlay, and then when I take a screenshot, I have an image that showed a preview of the camera, and my invoice is there too, which is exactly what I need.

Now UIGetScreenImage () is blocked, I could not find a way to do this. It just shows black for the camera.

Edit: all my other views are displayed absolutely normal, just not viewing the camera. Any ideas?!?!?

Here is the code I'm using at the moment.


UIGraphicsBeginImageContext(picker.view.bounds.size);
[picker.view.layer renderInContext:UIGraphicsGetCurrentContext()];
CGContextDrawImage(context, bounds, camView.CGImage);
UIImage* screenImage = UIGraphicsGetImageFromCurrentImageContext();
UIImageWriteToSavedPhotosAlbum(screenImage, nil, nil, nil); 
UIGraphicsEndImageContext();

Any ideas how I can get the overlay + camera image?

Thank!

+3
2

.

CGRect screenRect = [[UIScreen mainScreen] bounds];
        UIGraphicsBeginImageContext(screenRect.size);
        [self.layer renderInContext:UIGraphicsGetCurrentContext()];
        UIImage *sShot = UIGraphicsGetImageFromCurrentImageContext();
        UIGraphicsEndImageContext();
        UIImageWriteToSavedPhotosAlbum (sShot, nil, nil, nil);

?

, iphonedevsdk.com, iPhone.

0

Source: https://habr.com/ru/post/1756784/


All Articles