UIWindow not showing over content in iOS 13

后端 未结 12 1656
野的像风
野的像风 2020-12-07 17:41

I am upgrading my app to use the new UIScene patterns as defined in iOS 13, however a critical part of the app has stopped working. I have been using a UI

12条回答
  •  [愿得一人]
    2020-12-07 18:38

    Thank you @glassomoss. My problem is with UIAlertController.

    I solved my problem in this way:

    • I added a variable
    var windowsPopUp: UIWindow?
    
    • I modified the code to display the PopUp:
    public extension UIAlertController {
        func showPopUp() {
            windowsPopUp = UIWindow(frame: UIScreen.main.bounds)
            let vc = UIViewController()
            vc.view.backgroundColor = .clear
            windowsPopUp!.rootViewController = vc
            windowsPopUp!.windowLevel = UIWindow.Level.alert + 1
            windowsPopUp!.makeKeyAndVisible()
            vc.present(self, animated: true)
        }
    }
    
    • In the action of the UIAlertController I added:
    windowsPopUp = nil
    

    without the last line the PopUp is dismissed but the windows remains active not allowing the iteration with the application (with the application window)

提交回复
热议问题