applicationDidChangeScreenParameters 和 [NSWindow orderOut:]
在我的应用程序中,应用程序的窗口必须在系统更改分辨率时关闭。虽然实现 - (void)applicationDidChangeScreenParameters:(NSNotification *)notification
很容易,但我遇到了一个奇怪的错误。
奇怪的是,当此通知触发时,我的窗口似乎无法响应 orderOut:
调用。它正在触发,因为我的 NSLog 工作正常,我什至尝试放入 [NSApp Terminate:nil]
,这也工作正常。当命令窗口退出时,还有其他不相关的方法并且它们工作没有问题,这就是奇怪的地方。
在这种情况下我的窗口无法关闭是否有原因?什么可能导致这种情况?
In my application, it's necessary that the application's window close upon the system changing resolutions. While it's easy enough to implement - (void)applicationDidChangeScreenParameters:(NSNotification *)notification
, I've run into an odd bug.
Strangely, my window seems unable to respond to orderOut:
calls when this notification fires. It IS firing, because my NSLog works fine and I even tried dropping in [NSApp terminate:nil]
, which also works fine. There are other unrelated methods when that order the window out and they work without problems which is what makes it strange.
Is there are reason that my window is unable to close in these circumstances? What could cause this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以将关闭延迟到下一次运行事件循环吗?为此,请使用延迟为零的
-performSelector:withObject:afterDelay:
。Can you just delay the close until the next run through the event loop? To do this, use
‑performSelector:withObject:afterDelay:
with a delay of zero.