AppDelegate window 初始化大小不正确

AppDelegate window initialisation does not have correct size

我在 Xcode 中有一个应用程序,我想在没有故事板的情况下开始,所以我在 AppDelegate 中创建了一个新的 window:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

    let InitialViewController: SignViewController = SignViewController()
    let NavigationController: UINavigationController = UINavigationController(rootViewController: InitialViewController)

    self.window = UIWindow(frame: UIScreen.main.bounds)
    self.window!.rootViewController = NavigationController
    self.window!.makeKeyAndVisible()

    return true

}

这个问题是,如果我模拟它 returns 一个看起来很奇怪的屏幕,它在 y 轴上似乎很小,我不知道为什么:

谁能告诉我需要更改什么?

我遇到了和你一样的问题。检查你的 info.plist。您是否删除了 "Launch screen interface file base name"?有的话,加回去,问题就解决了