iOS Xcode 11 如何不使用storyboard
2020-02-28 本文已影响0人
Thelastgame
1.选中项目-->Generral-->Deployment-->Main Interface 设为空

2.删除Main.storyboard 文件--

3.删除info.plist下的Main.storyboard 描述(注意文件位置)

4.注意设置根视图的代码移动到了SceneDelegate.swift中了
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
guard let windowScene = (scene as? UIWindowScene) else { return }
window = UIWindow(frame: windowScene.coordinateSpace.bounds)
window?.windowScene = windowScene
window?.backgroundColor = UIColor.white
window?.makeKeyAndVisible()
window?.rootViewController = TabBarViewController()
}