skip to Main Content

Ios swift – How to take programatically take screenshot of an app in iOS with UIAlertController as the top controller?

extension UIViewController { static func takeScreenshot() -> UIImage? { guard let topController = UIApplication.getTopController() else { return nil } if let view = topController.view { UIGraphicsBeginImageContextWithOptions(view.bounds.size, false, UIScreen.main.scale) defer { UIGraphicsEndImageContext() } if let context = UIGraphicsGetCurrentContext() { view.layer.render(in: context)…

VIEW QUESTION
Back To Top
Search