【发布时间】:2019-11-08 14:47:43
【问题描述】:
请你看看 repo https://github.com/Rukomoynikov/InitialViewControllerProgrammatically 并帮助我。为什么我在尝试实例化ViewController 时出现黑屏。
这是我的 AppDelegate:
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
window = UIWindow.init(frame: UIScreen.main.bounds)
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let viewController = storyboard.instantiateViewController(withIdentifier: "ViewController") as! ViewController
guard window != nil else { return true }
self.window!.backgroundColor = .darkGray
self.window!.rootViewController = viewController
self.window!.makeKeyAndVisible()
return true
}
}
情侣详情。
- 在上一个 Xcode 版本中创建的应用程序。
- iOs 部署目标从 13 更改为 12。
- SceneDelegate 已移除。
- 在目标设置选项中主界面已清除。
- 在 info.plist 中 StoryBoardName 和 DelegateClassName 也被删除。
【问题讨论】: