You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

77 lines
2.8 KiB

2 months ago
2 months ago
2 months ago
  1. //
  2. // SceneDelegate.m
  3. // HC
  4. //
  5. // Created by huilinLi on 2025/11/17.
  6. //
  7. #import "SceneDelegate.h"
  8. #import "AppDelegate.h"
  9. #import "ViewController.h"
  10. #import "ChartViewController.h"
  11. @interface SceneDelegate ()
  12. @end
  13. @implementation SceneDelegate
  14. - (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions {
  15. UIWindowScene *windowScene = (UIWindowScene *)scene;
  16. if (!windowScene) return;
  17. self.window = [[UIWindow alloc] initWithWindowScene:windowScene];
  18. // 改用窗口场景的屏幕尺寸(兼容 iOS 26+
  19. self.window.frame = windowScene.screen.bounds;
  20. self.window.backgroundColor = [UIColor blackColor];
  21. //ViewController *loginVC = [[ViewController alloc] init];
  22. //UINavigationController *navVC = [[UINavigationController alloc] initWithRootViewController:loginVC];
  23. //self.window.rootViewController = navVC;
  24. // 实例化 ChartViewController
  25. ChartViewController *chartVC = [[ChartViewController alloc] init];
  26. // **设置 ChartViewController 为根视图控制器**
  27. self.window.rootViewController = chartVC;
  28. [self.window makeKeyAndVisible];
  29. }
  30. - (void)sceneDidDisconnect:(UIScene *)scene {
  31. // Called as the scene is being released by the system.
  32. // This occurs shortly after the scene enters the background, or when its session is discarded.
  33. // Release any resources associated with this scene that can be re-created the next time the scene connects.
  34. // The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead).
  35. }
  36. - (void)sceneDidBecomeActive:(UIScene *)scene {
  37. // Called when the scene has moved from an inactive state to an active state.
  38. // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
  39. }
  40. - (void)sceneWillResignActive:(UIScene *)scene {
  41. // Called when the scene will move from an active state to an inactive state.
  42. // This may occur due to temporary interruptions (ex. an incoming phone call).
  43. }
  44. - (void)sceneWillEnterForeground:(UIScene *)scene {
  45. // Called as the scene transitions from the background to the foreground.
  46. // Use this method to undo the changes made on entering the background.
  47. }
  48. - (void)sceneDidEnterBackground:(UIScene *)scene {
  49. // Called as the scene transitions from the foreground to the background.
  50. // Use this method to save data, release shared resources, and store enough scene-specific state information
  51. // to restore the scene back to its current state.
  52. // Save changes in the application's managed object context when the application transitions to the background.
  53. [(AppDelegate *)UIApplication.sharedApplication.delegate saveContext];
  54. }
  55. @end