SceneDelegate.m 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. //
  2. // SceneDelegate.m
  3. // PDFViewer
  4. //
  5. // Created by kdan on 2022/11/14.
  6. //
  7. #import <ComPDFKit/ComPDFKit.h>
  8. #import "SceneDelegate.h"
  9. #import "CPDFController.h"
  10. #import "CPDFModel.h"
  11. @interface SceneDelegate ()
  12. @end
  13. @implementation SceneDelegate
  14. - (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions {
  15. // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
  16. // If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
  17. // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
  18. [self setWindow:[[UIWindow alloc] initWithWindowScene:(UIWindowScene *)scene]];
  19. [self.window setBackgroundColor:[UIColor whiteColor]];
  20. [self.window makeKeyAndVisible];
  21. NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
  22. [paths objectAtIndex:0];
  23. CPDFModel *model = [[CPDFModel alloc] init];
  24. model.filePath = [paths objectAtIndex:0];
  25. NSLog(@"%@",model.filePath);
  26. CPDFController *pdfController = [[CPDFController alloc] initWithModel:model];
  27. [self.window setRootViewController:pdfController];
  28. }
  29. - (void)sceneDidDisconnect:(UIScene *)scene {
  30. // Called as the scene is being released by the system.
  31. // This occurs shortly after the scene enters the background, or when its session is discarded.
  32. // Release any resources associated with this scene that can be re-created the next time the scene connects.
  33. // The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead).
  34. }
  35. - (void)sceneDidBecomeActive:(UIScene *)scene {
  36. // Called when the scene has moved from an inactive state to an active state.
  37. // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
  38. }
  39. - (void)sceneWillResignActive:(UIScene *)scene {
  40. // Called when the scene will move from an active state to an inactive state.
  41. // This may occur due to temporary interruptions (ex. an incoming phone call).
  42. }
  43. - (void)sceneWillEnterForeground:(UIScene *)scene {
  44. // Called as the scene transitions from the background to the foreground.
  45. // Use this method to undo the changes made on entering the background.
  46. }
  47. - (void)sceneDidEnterBackground:(UIScene *)scene {
  48. // Called as the scene transitions from the foreground to the background.
  49. // Use this method to save data, release shared resources, and store enough scene-specific state information
  50. // to restore the scene back to its current state.
  51. }
  52. @end