AppDelegate.swift是管理App的整个生命周期
//当应用程序载入后执行此方法
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions:
[UIApplication.LaunchOptionsKey: Any]?) -> Bool {
self.window = UIWindow.init(frame: UIScreen.main.bounds)
self.window?.backgroundColor = UIColor.white
let navtion = UINavigationController.init(rootViewController: ContentViewController()) //指定app启动之后运行的页面文件
self.window?.rootViewController = navtion
self.window?.makeKeyAndVisible()
return true
}
func applicationWillResignActive(_ application: UIApplication) {
//应用程序进入非活跃状态时执行
}
func applicationDidEnterBackground(_ application: UIApplication) {
//应用程序进入后台时执行
}
func applicationWillEnterForeground(_ application: UIApplication) {
//应用程序从后台重新推入前台时执行
}
func applicationDidBecomeActive(_ application: UIApplication) {
//应用程序进入活跃状态时执行
}
func applicationWillTerminate(_ application: UIApplication) {
//应用程序退出时执行
}