启动屏幕后显示黑屏

问题描述 投票:0回答:3

我有一个故事板文件,我想将其用作启动屏幕。我已将故事板中的 ViewController 设置为第一个。

我也像这样设置了启动屏幕:

这是我的

SceneDelegate
中用于选择第一个 ViewController 来向用户显示的代码:

self.window = UIWindow(frame: UIScreen.main.bounds)
let vc = storyboard.instantiateViewController (withIdentifier: "Channels") as! UINavigationController
window = UIWindow(windowScene: windowScene)
window?.rootViewController = vc
window?.makeKeyAndVisible()

我第一次启动应用程序时看到启动屏幕,然后是黑屏;最后是我的用户界面。

ios swift storyboard uiscenedelegate
3个回答
2
投票

检查故事板中的 ViewController 是否选择了“is Initial Viewcontroller”。 See this screenshot


1
投票

听起来你在某个地方有一个没有背景颜色的初始视图控制器。我建议您仔细检查故事板并检查右侧面板中是否选中了“is Initial ViewController”框。


0
投票

我有结构化项目文件,并将 info.plist 移动到“RequiredFiles”文件夹中。

但是在构建设置中,info.plist 路径是“ProjectName/Info.plist”。 我将其更改为“ProjectName/RequiredFiles/Info.plist”

这解决了我的问题,希望它也能解决其他人的问题......

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