Objective c 检测macOS 10.14强调色何时更改

Objective c 检测macOS 10.14强调色何时更改,objective-c,macos,nscolor,Objective C,Macos,Nscolor,在macOS 10.14中,您可以通过收听以下通知来检测系统主题何时发生更改: [NSDistributedNotificationCenter.defaultCenter addObserver: self selector: @selector(OSThemeChanged:) name

在macOS 10.14中,您可以通过收听以下通知来检测系统主题何时发生更改:

[NSDistributedNotificationCenter.defaultCenter addObserver: self
                                                  selector: @selector(OSThemeChanged:)
                                                      name: @"AppleInterfaceThemeChangedNotification"
                                                    object: nil];
但是当
重音颜色改变时,不会触发该命令()。我有一个图像,我想修改的基础上的口音颜色,所以我想知道它什么时候改变


有没有人能弄明白这一点?

AppleColorPreferencesChangedNotification
键应该可以工作我相信:

    [[NSDistributedNotificationCenter defaultCenter] addObserver:self
                                                        selector:@selector(accentColorChanged:)
                                                            name:@"AppleColorPreferencesChangedNotification"
                                                          object:nil];
只有更改首选项并关闭“系统首选项常规”窗口后,才会发送通知


但是,找不到要链接的文档。

这似乎解决了问题,谢谢。另外,我还发现了另一种解决方法,在
accentColor
更改时调用
drawRect:
。通过存储accentColor详细信息,然后将其与当前accentColor详细信息进行比较,我还能够检测到更改(并且无需等待首选项窗口关闭)。