I've a CustomView. The CustomerVIew contains 2 views, one more custom view which has WkWebview & one normal xib for branding.
This Customview is added to anotherview, screenshotview like shown below.
anothercustomtView contains the WKWebView
ContentView
ScreenshotView
I am trying to capture the complete screen using
however except the WKWebView which I can see on screen rest everything is captured.
If I use self.view as below, I see even the wkwebview is captured.
Kind of stuck with this. Can anyone help with this? Thanks!
This Customview is added to anotherview, screenshotview like shown below.
anothercustomtView contains the WKWebView
ContentView
Code Block let contentView = UIView(frame: screenshotBounds) contentView.backgroundColor = UIColor.white contentView.addSubview(anothercustomtView) contentView.addSubview(xibbrandingView)
ScreenshotView
Code Block let screenshotView = UIView(frame: screenshotBounds.insetBy(dx: -padding, dy: -padding)) screenshotView.addSubview(contentView)
I am trying to capture the complete screen using
Code Block UIGraphicsBeginImageContextWithOptions(screenshotView.bounds.size, true, 0) screenshotView.drawHierarchy(in: screenshotView.bounds, afterScreenUpdates: true) let screenshot = UIGraphicsGetImageFromCurrentImageContext()! UIGraphicsEndImageContext()
however except the WKWebView which I can see on screen rest everything is captured.
If I use self.view as below, I see even the wkwebview is captured.
Code Block UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, true, 0) self.view.drawHierarchy(in: self.view.bounds, afterScreenUpdates: true) let screenshot = UIGraphicsGetImageFromCurrentImageContext()! UIGraphicsEndImageContext()
Kind of stuck with this. Can anyone help with this? Thanks!