Swift APPDelegate 文件写法
通过导航视图控制器设置根视图
AppDelegate.swift
import UIKit
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
self.window = UIWindow(frame: UIScreen.main.bounds)
// 把初始视图控制器压入导航视图控制器
let navigationController = UINavigationController(rootViewController: MyRootViewController())
// 把根视图控制器设为导航视图控制器
self.window?.rootViewController = navigationController
// 渲染页面
return true
}
}
本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处!