视图未覆盖全屏(程序性故事板Swift)

问题描述 投票:2回答:1

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

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()
}

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

enter image description here

ios xcode storyboard interface-builder
1个回答
0
投票

确保您具有LaunchScreen故事板。

© www.soinside.com 2019 - 2024. All rights reserved.