SceneDelegate.swift 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. //
  2. // SceneDelegate.swift
  3. // Inhealth
  4. //
  5. // Created by weclouds on 2019/12/6.
  6. // Copyright © 2019 weclouds. All rights reserved.
  7. //
  8. import UIKit
  9. import IQKeyboardManagerSwift
  10. @available(iOS 13.0, *)
  11. class SceneDelegate: UIResponder, UIWindowSceneDelegate {
  12. var window: UIWindow?
  13. @available(iOS 13.0, *)
  14. func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
  15. log.debug("didFinishLaunchingWithOptions 开始执行")
  16. let def = UserDefaults.standard
  17. let userDefaultLanguages = def.object(forKey: "userDefaultLanguages")
  18. log.debug("当前语言\(userDefaultLanguages)" )
  19. def.set("en", forKey: "userDefaultLanguages")
  20. //设置键盘
  21. IQKeyboardManager.shared.enable = true
  22. IQKeyboardManager.shared.toolbarTintColor = UIColor(hexString: "#333333")
  23. UINavigationBar.appearance().barStyle = .default
  24. //创建window
  25. let windowScene = scene as! UIWindowScene
  26. window = UIWindow(frame: UIScreen.main.bounds)
  27. window?.windowScene = windowScene
  28. window?.backgroundColor = UIColor.white
  29. //创建根控制器
  30. let vc = IHLoginVCtr()
  31. window?.rootViewController = vc
  32. //显示界面
  33. window?.makeKeyAndVisible()
  34. //FHHFPSIndicator.shared()?.show()
  35. guard let _ = (scene as? UIWindowScene) else { return }
  36. log.debug("didFinishLaunchingWithOptions 跑完了")
  37. }
  38. func sceneDidDisconnect(_ scene: UIScene) {
  39. // Called as the scene is being released by the system.
  40. // This occurs shortly after the scene enters the background, or when its session is discarded.
  41. // Release any resources associated with this scene that can be re-created the next time the scene connects.
  42. // The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead).
  43. }
  44. func sceneDidBecomeActive(_ scene: UIScene) {
  45. // Called when the scene has moved from an inactive state to an active state.
  46. // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
  47. }
  48. func sceneWillResignActive(_ scene: UIScene) {
  49. // Called when the scene will move from an active state to an inactive state.
  50. // This may occur due to temporary interruptions (ex. an incoming phone call).
  51. }
  52. func sceneWillEnterForeground(_ scene: UIScene) {
  53. // Called as the scene transitions from the background to the foreground.
  54. // Use this method to undo the changes made on entering the background.
  55. }
  56. func sceneDidEnterBackground(_ scene: UIScene) {
  57. // Called as the scene transitions from the foreground to the background.
  58. // Use this method to save data, release shared resources, and store enough scene-specific state information
  59. // to restore the scene back to its current state.
  60. }
  61. }