在Xcode 11中,现在在SceneDelegate中配置了初始窗口,这是我的代码和结果的图片:

func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {

     print("Scene willConnectTo.")
       guard let windowScene = (scene as? UIWindowScene) else { return }

    //  window =  UIWindow(frame: windowScene.coordinateSpace.bounds)
    window =  self.window ?? UIWindow()
     let mainView = ViewController()
    mainView.title = "TEST"
     let navigationController = UINavigationController()
    navigationController.viewControllers = [mainView]
    window?.backgroundColor = .red
    window?.windowScene = windowScene
    window?.rootViewController = navigationController
    window?.makeKeyAndVisible()
}

任何人都可以建议如何使视图覆盖所有屏幕吗?

ios -  View 未覆盖全屏(程序化 StoryboardSwift)-LMLPHP

最佳答案

确保您具有LaunchScreen故事板。

09-04 01:02