Macos 检测OSX上的监视器更改
我有一个应用程序,它会请求有关监视器更改的通知,以便重新配置,如果我添加监视器,这些通知当前不会被触发:Macos 检测OSX上的监视器更改,macos,notifications,screen,Macos,Notifications,Screen,我有一个应用程序,它会请求有关监视器更改的通知,以便重新配置,如果我添加监视器,这些通知当前不会被触发: [[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(distNotificationHook:)
[[NSDistributedNotificationCenter defaultCenter] addObserver:self
selector:@selector(distNotificationHook:)
name:NSApplicationDidChangeScreenParametersNotification
object:nil];
[[NSDistributedNotificationCenter defaultCenter] addObserver:self
selector:@selector(distNotificationHook:)
name:@"com.apple.BezelServices.BMDisplayHWReconfiguredEvent"
object:nil];
他们过去常工作。。但现在不是了。有人知道我做错了什么吗?问题是这需要使用NSNotificationCenter,而不是NSDistributedNotificationCenter:
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(distNotificationHook:)
name:@"com.apple.BezelServices.BMDisplayHWReconfiguredEvent"
object:nil];