[英]View not covering full screen (programmatic storyboard Swift)
在 Xcode 11 初始 window 現在在 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()
}
誰能建議如何使視圖覆蓋所有屏幕?
確保您有 LaunchScreen storyboard。
似乎不可能以編程方式執行 LaunchScreen,因為屏幕將在應用程序啟動之前由操作系統加載,請參閱此處
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.