Commit b27b2e9bffe4e9a4619adb7b01e40c99a87ff768
1 parent
4045a382
自定义 主window
Showing
5 changed files
with
10 additions
and
88 deletions
metaCode.xcodeproj/project.pbxproj
| @@ -10,7 +10,6 @@ | @@ -10,7 +10,6 @@ | ||
| 10 | 0D39E93D7229931C86EB1161 /* Pods_metaCode_metaCodeUITests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 63D879B49B1E42F1584DD75E /* Pods_metaCode_metaCodeUITests.framework */; }; | 10 | 0D39E93D7229931C86EB1161 /* Pods_metaCode_metaCodeUITests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 63D879B49B1E42F1584DD75E /* Pods_metaCode_metaCodeUITests.framework */; }; |
| 11 | 1DD2808DF02C120276F99F4D /* Pods_metaCode.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F1C55A719CFEE073C06D37CE /* Pods_metaCode.framework */; }; | 11 | 1DD2808DF02C120276F99F4D /* Pods_metaCode.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F1C55A719CFEE073C06D37CE /* Pods_metaCode.framework */; }; |
| 12 | 818163BC2A25CFCC00579C86 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 818163BB2A25CFCC00579C86 /* AppDelegate.swift */; }; | 12 | 818163BC2A25CFCC00579C86 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 818163BB2A25CFCC00579C86 /* AppDelegate.swift */; }; |
| 13 | - 818163BE2A25CFCC00579C86 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 818163BD2A25CFCC00579C86 /* SceneDelegate.swift */; }; | ||
| 14 | 818163C02A25CFCC00579C86 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 818163BF2A25CFCC00579C86 /* ViewController.swift */; }; | 13 | 818163C02A25CFCC00579C86 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 818163BF2A25CFCC00579C86 /* ViewController.swift */; }; |
| 15 | 818163C32A25CFCC00579C86 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 818163C12A25CFCC00579C86 /* Main.storyboard */; }; | 14 | 818163C32A25CFCC00579C86 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 818163C12A25CFCC00579C86 /* Main.storyboard */; }; |
| 16 | 818163C52A25CFCF00579C86 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 818163C42A25CFCF00579C86 /* Assets.xcassets */; }; | 15 | 818163C52A25CFCF00579C86 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 818163C42A25CFCF00579C86 /* Assets.xcassets */; }; |
| @@ -47,7 +46,6 @@ | @@ -47,7 +46,6 @@ | ||
| 47 | 721865F548C997EFAE525B6F /* Pods-metaCode-metaCodeUITests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-metaCode-metaCodeUITests.release.xcconfig"; path = "Target Support Files/Pods-metaCode-metaCodeUITests/Pods-metaCode-metaCodeUITests.release.xcconfig"; sourceTree = "<group>"; }; | 46 | 721865F548C997EFAE525B6F /* Pods-metaCode-metaCodeUITests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-metaCode-metaCodeUITests.release.xcconfig"; path = "Target Support Files/Pods-metaCode-metaCodeUITests/Pods-metaCode-metaCodeUITests.release.xcconfig"; sourceTree = "<group>"; }; |
| 48 | 818163B82A25CFCC00579C86 /* metaCode.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = metaCode.app; sourceTree = BUILT_PRODUCTS_DIR; }; | 47 | 818163B82A25CFCC00579C86 /* metaCode.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = metaCode.app; sourceTree = BUILT_PRODUCTS_DIR; }; |
| 49 | 818163BB2A25CFCC00579C86 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; | 48 | 818163BB2A25CFCC00579C86 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; |
| 50 | - 818163BD2A25CFCC00579C86 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; }; | ||
| 51 | 818163BF2A25CFCC00579C86 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; }; | 49 | 818163BF2A25CFCC00579C86 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; }; |
| 52 | 818163C22A25CFCC00579C86 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; }; | 50 | 818163C22A25CFCC00579C86 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; }; |
| 53 | 818163C42A25CFCF00579C86 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; | 51 | 818163C42A25CFCF00579C86 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; |
| @@ -101,7 +99,6 @@ | @@ -101,7 +99,6 @@ | ||
| 101 | F0569578297630A48BF85754 /* Pods-metaCodeTests.debug.xcconfig */, | 99 | F0569578297630A48BF85754 /* Pods-metaCodeTests.debug.xcconfig */, |
| 102 | 67F8190701D1AB7F7724E8BA /* Pods-metaCodeTests.release.xcconfig */, | 100 | 67F8190701D1AB7F7724E8BA /* Pods-metaCodeTests.release.xcconfig */, |
| 103 | ); | 101 | ); |
| 104 | - name = Pods; | ||
| 105 | path = Pods; | 102 | path = Pods; |
| 106 | sourceTree = "<group>"; | 103 | sourceTree = "<group>"; |
| 107 | }; | 104 | }; |
| @@ -131,7 +128,6 @@ | @@ -131,7 +128,6 @@ | ||
| 131 | isa = PBXGroup; | 128 | isa = PBXGroup; |
| 132 | children = ( | 129 | children = ( |
| 133 | 818163BB2A25CFCC00579C86 /* AppDelegate.swift */, | 130 | 818163BB2A25CFCC00579C86 /* AppDelegate.swift */, |
| 134 | - 818163BD2A25CFCC00579C86 /* SceneDelegate.swift */, | ||
| 135 | 818163BF2A25CFCC00579C86 /* ViewController.swift */, | 131 | 818163BF2A25CFCC00579C86 /* ViewController.swift */, |
| 136 | 818163C12A25CFCC00579C86 /* Main.storyboard */, | 132 | 818163C12A25CFCC00579C86 /* Main.storyboard */, |
| 137 | 818163C42A25CFCF00579C86 /* Assets.xcassets */, | 133 | 818163C42A25CFCF00579C86 /* Assets.xcassets */, |
| @@ -409,7 +405,6 @@ | @@ -409,7 +405,6 @@ | ||
| 409 | files = ( | 405 | files = ( |
| 410 | 818163C02A25CFCC00579C86 /* ViewController.swift in Sources */, | 406 | 818163C02A25CFCC00579C86 /* ViewController.swift in Sources */, |
| 411 | 818163BC2A25CFCC00579C86 /* AppDelegate.swift in Sources */, | 407 | 818163BC2A25CFCC00579C86 /* AppDelegate.swift in Sources */, |
| 412 | - 818163BE2A25CFCC00579C86 /* SceneDelegate.swift in Sources */, | ||
| 413 | ); | 408 | ); |
| 414 | runOnlyForDeploymentPostprocessing = 0; | 409 | runOnlyForDeploymentPostprocessing = 0; |
| 415 | }; | 410 | }; |
| @@ -591,7 +586,7 @@ | @@ -591,7 +586,7 @@ | ||
| 591 | GENERATE_INFOPLIST_FILE = YES; | 586 | GENERATE_INFOPLIST_FILE = YES; |
| 592 | INFOPLIST_FILE = metaCode/Info.plist; | 587 | INFOPLIST_FILE = metaCode/Info.plist; |
| 593 | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; | 588 | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; |
| 594 | - INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; | 589 | + INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen.storyboard; |
| 595 | INFOPLIST_KEY_UIMainStoryboardFile = Main; | 590 | INFOPLIST_KEY_UIMainStoryboardFile = Main; |
| 596 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; | 591 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; |
| 597 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; | 592 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; |
| @@ -621,7 +616,7 @@ | @@ -621,7 +616,7 @@ | ||
| 621 | GENERATE_INFOPLIST_FILE = YES; | 616 | GENERATE_INFOPLIST_FILE = YES; |
| 622 | INFOPLIST_FILE = metaCode/Info.plist; | 617 | INFOPLIST_FILE = metaCode/Info.plist; |
| 623 | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; | 618 | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; |
| 624 | - INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; | 619 | + INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen.storyboard; |
| 625 | INFOPLIST_KEY_UIMainStoryboardFile = Main; | 620 | INFOPLIST_KEY_UIMainStoryboardFile = Main; |
| 626 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; | 621 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; |
| 627 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; | 622 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; |
metaCode/AppDelegate.swift
| @@ -9,28 +9,20 @@ import UIKit | @@ -9,28 +9,20 @@ import UIKit | ||
| 9 | 9 | ||
| 10 | @main | 10 | @main |
| 11 | class AppDelegate: UIResponder, UIApplicationDelegate { | 11 | class AppDelegate: UIResponder, UIApplicationDelegate { |
| 12 | - | 12 | + var window: UIWindow? |
| 13 | 13 | ||
| 14 | 14 | ||
| 15 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { | 15 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { |
| 16 | + | ||
| 16 | // Override point for customization after application launch. | 17 | // Override point for customization after application launch. |
| 18 | + window = UIWindow.init(frame: UIScreen.main.bounds) | ||
| 19 | + window?.backgroundColor = UIColor.white | ||
| 20 | + window?.rootViewController = ViewController.init() | ||
| 21 | + window?.makeKeyAndVisible() | ||
| 22 | + | ||
| 17 | return true | 23 | return true |
| 18 | } | 24 | } |
| 19 | 25 | ||
| 20 | - // MARK: UISceneSession Lifecycle | ||
| 21 | - | ||
| 22 | - func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { | ||
| 23 | - // Called when a new scene session is being created. | ||
| 24 | - // Use this method to select a configuration to create the new scene with. | ||
| 25 | - return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) | ||
| 26 | - } | ||
| 27 | - | ||
| 28 | - func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) { | ||
| 29 | - // Called when the user discards a scene session. | ||
| 30 | - // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. | ||
| 31 | - // Use this method to release any resources that were specific to the discarded scenes, as they will not return. | ||
| 32 | - } | ||
| 33 | - | ||
| 34 | 26 | ||
| 35 | } | 27 | } |
| 36 | 28 |
metaCode/Info.plist
| @@ -6,20 +6,6 @@ | @@ -6,20 +6,6 @@ | ||
| 6 | <dict> | 6 | <dict> |
| 7 | <key>UIApplicationSupportsMultipleScenes</key> | 7 | <key>UIApplicationSupportsMultipleScenes</key> |
| 8 | <false/> | 8 | <false/> |
| 9 | - <key>UISceneConfigurations</key> | ||
| 10 | - <dict> | ||
| 11 | - <key>UIWindowSceneSessionRoleApplication</key> | ||
| 12 | - <array> | ||
| 13 | - <dict> | ||
| 14 | - <key>UISceneConfigurationName</key> | ||
| 15 | - <string>Default Configuration</string> | ||
| 16 | - <key>UISceneDelegateClassName</key> | ||
| 17 | - <string>$(PRODUCT_MODULE_NAME).SceneDelegate</string> | ||
| 18 | - <key>UISceneStoryboardFile</key> | ||
| 19 | - <string>Main</string> | ||
| 20 | - </dict> | ||
| 21 | - </array> | ||
| 22 | - </dict> | ||
| 23 | </dict> | 9 | </dict> |
| 24 | </dict> | 10 | </dict> |
| 25 | </plist> | 11 | </plist> |
metaCode/SceneDelegate.swift deleted
100644 → 0
| 1 | -// | ||
| 2 | -// SceneDelegate.swift | ||
| 3 | -// metaCode | ||
| 4 | -// | ||
| 5 | -// Created by iOS on 2023/5/30. | ||
| 6 | -// | ||
| 7 | - | ||
| 8 | -import UIKit | ||
| 9 | - | ||
| 10 | -class SceneDelegate: UIResponder, UIWindowSceneDelegate { | ||
| 11 | - | ||
| 12 | - var window: UIWindow? | ||
| 13 | - | ||
| 14 | - | ||
| 15 | - func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { | ||
| 16 | - // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. | ||
| 17 | - // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. | ||
| 18 | - // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). | ||
| 19 | - guard let _ = (scene as? UIWindowScene) else { return } | ||
| 20 | - } | ||
| 21 | - | ||
| 22 | - func sceneDidDisconnect(_ scene: UIScene) { | ||
| 23 | - // Called as the scene is being released by the system. | ||
| 24 | - // This occurs shortly after the scene enters the background, or when its session is discarded. | ||
| 25 | - // Release any resources associated with this scene that can be re-created the next time the scene connects. | ||
| 26 | - // The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead). | ||
| 27 | - } | ||
| 28 | - | ||
| 29 | - func sceneDidBecomeActive(_ scene: UIScene) { | ||
| 30 | - // Called when the scene has moved from an inactive state to an active state. | ||
| 31 | - // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. | ||
| 32 | - } | ||
| 33 | - | ||
| 34 | - func sceneWillResignActive(_ scene: UIScene) { | ||
| 35 | - // Called when the scene will move from an active state to an inactive state. | ||
| 36 | - // This may occur due to temporary interruptions (ex. an incoming phone call). | ||
| 37 | - } | ||
| 38 | - | ||
| 39 | - func sceneWillEnterForeground(_ scene: UIScene) { | ||
| 40 | - // Called as the scene transitions from the background to the foreground. | ||
| 41 | - // Use this method to undo the changes made on entering the background. | ||
| 42 | - } | ||
| 43 | - | ||
| 44 | - func sceneDidEnterBackground(_ scene: UIScene) { | ||
| 45 | - // Called as the scene transitions from the foreground to the background. | ||
| 46 | - // Use this method to save data, release shared resources, and store enough scene-specific state information | ||
| 47 | - // to restore the scene back to its current state. | ||
| 48 | - } | ||
| 49 | - | ||
| 50 | - | ||
| 51 | -} | ||
| 52 | - |
metaCode/ViewController.swift
| @@ -12,6 +12,7 @@ class ViewController: UIViewController { | @@ -12,6 +12,7 @@ class ViewController: UIViewController { | ||
| 12 | override func viewDidLoad() { | 12 | override func viewDidLoad() { |
| 13 | super.viewDidLoad() | 13 | super.viewDidLoad() |
| 14 | // Do any additional setup after loading the view. | 14 | // Do any additional setup after loading the view. |
| 15 | + self.view.backgroundColor = .gray | ||
| 15 | } | 16 | } |
| 16 | 17 | ||
| 17 | 18 |