11.swift5-删除main.storyboard,并设置代码启动

要删除info.plist的两个地方


11.swift5-删除main.storyboard,并设置代码启动


11.swift5-删除main.storyboard,并设置代码启动


代码也需要修改,appDelgate:

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

let window = UIWindow(frame: UIScreen.main.bounds)

let viewController = ViewController()

window.rootViewController = viewController

window.makeKeyAndVisible()

self.window = window

return true

}

sceneDelegate:

func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {

if let windowScene = scene as? UIWindowScene {

let window = UIWindow(windowScene: windowScene)

let viewController = ViewController()

window.rootViewController = viewController

self.window = window

window.makeKeyAndVisible()

}

}

以上启动代码为单个view的,以后有空再加导航栏的写法进来。


分享到:


相關文章: