3

I've a problem screenshotting a main UIView containing a subview showing a video stream inside it. When I take a screenshot the image is correct less the rectangle with the video stream that is black, stream image is not showed !

The screenshot bugged bad screenshot image

and the correct image correct screenshot image

The iOS versione is 13.2.3 and the same code works properly on iOS 12. I tried using UIGraphicsImageRenderer and renderer.image

guard let layer = UIApplication.shared.keyWindow?.layer else { return }
let renderer = UIGraphicsImageRenderer(size: layer.frame.size)
let image = renderer.image(actions: { context in
     layer.render(in: context.cgContext)
 })

also tried with drawHierarchy

let renderer = UIGraphicsImageRenderer(size: view.bounds.size)
let image = renderer.image { context in
    view.drawHierarchy(in: view.bounds, afterScreenUpdates: true)
}

and other ways always with the same bad result.

It seems similar to iOS 13 UITextView converting UITextView to image is not working properly. Working fine in below iOS 12

Any idea ?

aldopa
  • 31
  • 3

0 Answers0