KMPageEditPopViewController.m 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. //
  2. // KMPageEditPopViewController.m
  3. // PDF Reader Pro Edition
  4. //
  5. // Created by 丁林圭 on 2019/12/24.
  6. //
  7. #import "KMPageEditPopViewController.h"
  8. #import <PDF_Reader_Pro-Swift.h>
  9. @interface KMPageEditPopViewController ()
  10. @property (nonatomic,assign) IBOutlet NSTextField *titleLabel;
  11. @property (nonatomic,assign) IBOutlet NSTextField *titlesubLabel;
  12. @end
  13. @implementation KMPageEditPopViewController
  14. + (BOOL)showPageEditDetails
  15. {
  16. BOOL isOpenConvertDetails = [[NSUserDefaults standardUserDefaults] boolForKey:@"KMPageEditHaveOpenConvertDetails"];
  17. if (!isOpenConvertDetails) {
  18. [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"KMPageEditHaveOpenConvertDetails"];
  19. [[NSUserDefaults standardUserDefaults] synchronize];
  20. return YES;
  21. }
  22. return NO;
  23. }
  24. - (void)viewDidLoad {
  25. [super viewDidLoad];
  26. self.view.wantsLayer = YES;
  27. [self updateViewColor];
  28. self.titleLabel.stringValue = NSLocalizedString(@"The Best PDF Editor", nil);
  29. self.titlesubLabel.stringValue = NSLocalizedString(@"It’s super simple to organize your PDF file into a professional-looking document. Insert, replace, extract, split, rotate, copy, delete, rearrange PDF pages and organize those pages just the way you like it, all in a matter of seconds. Drag-and-drop makes it more efficient.", nil);
  30. [NSDistributedNotificationCenter.defaultCenter addObserver:self selector:@selector(themeChanged:) name:@"AppleInterfaceThemeChangedNotification" object: nil];
  31. }
  32. - (void)themeChanged:(NSNotification *)notification {
  33. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  34. [self updateViewColor];
  35. });
  36. }
  37. #pragma mark - DarkMode
  38. - (void)updateViewColor {
  39. if([KMAppearance isDarkMode]){
  40. self.view.layer.backgroundColor = [NSColor colorWithRed:0.133 green:0.478 blue:1.000 alpha:1].CGColor;
  41. } else {
  42. self.view.layer.backgroundColor = [NSColor colorWithRed:0.286 green:0.510 blue:0.902 alpha:1].CGColor;
  43. }
  44. }
  45. - (void)dealloc {
  46. [[NSNotificationCenter defaultCenter]removeObserver:self];
  47. // [super dealloc];
  48. }
  49. @end