iOS13 创建项目SceneDelegate文件
Posted liuw_flexi
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了iOS13 创建项目SceneDelegate文件相关的知识,希望对你有一定的参考价值。
// // SceneDelegate.swift // 菜鸟教程 // // Created by udc on 2019/11/29. // Copyright © 2019 udc. All rights reserved. // import UIKit class SceneDelegate: UIResponder, UIWindowSceneDelegate { var window: UIWindow? func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). guard let _ = (scene as? UIWindowScene) else { return } } func sceneDidDisconnect(_ scene: UIScene) { // Called as the scene is being released by the system. // This occurs shortly after the scene enters the background, or when its session is discarded. // Release any resources associated with this scene that can be re-created the next time the scene connects. // The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead). } func sceneDidBecomeActive(_ scene: UIScene) { // Called when the scene has moved from an inactive state to an active state. // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. } func sceneWillResignActive(_ scene: UIScene) { // Called when the scene will move from an active state to an inactive state. // This may occur due to temporary interruptions (ex. an incoming phone call). } func sceneWillEnterForeground(_ scene: UIScene) { // Called as the scene transitions from the background to the foreground. // Use this method to undo the changes made on entering the background. } func sceneDidEnterBackground(_ scene: UIScene) { // Called as the scene transitions from the foreground to the background. // Use this method to save data, release shared resources, and store enough scene-specific state information // to restore the scene back to its current state. } }
此文件是给多窗口开发用的,一般用不到。删除即可。
https://blog.csdn.net/BUG_delete/article/details/103699563
以上是关于iOS13 创建项目SceneDelegate文件的主要内容,如果未能解决你的问题,请参考以下文章
iOS-Xcode11: 删除默认Main.storyBoard, 自定义UIWindow不能在AppDelegate中处理,新增SceneDelegate代理
如何在 Xcode 11 中启动没有故事板 >= iOS 13 的新项目?
推送通知 - 使用 SceneDelegate 在通知点击时推送 ViewController
从 iOS 11+ 项目中删除 SceneDelegate 的正确方法 - 应用程序中需要哪些代码(_:didFinishLaunchingWithOptions)