Xcode11:UIWindow 不能在AppDelegate中处理了

func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
        guard let windowS = (scene as? UIWindowScene) else { return }
        let vc = ViewController()
        let nav = UINavigationController(rootViewController: vc)

         //初始化window时,要用windowS:这个方法拿到windowS来初始化,否则初始化后的界面是黑的
        window = UIWindow(windowScene: windowS)
        window?.rootViewController = nav
        window?.makeKeyAndVisible()
    }

你可能感兴趣的:(Xcode11:UIWindow 不能在AppDelegate中处理了)