如何在NSWindow关闭时收到通知 [英] How to get notified when NSWindow closes

查看:385
本文介绍了如何在NSWindow关闭时收到通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当NSWindow应该或将要关闭时,如何注意?我想有一个像窗口WillClose。不幸的是,NSWindowController没有像UIViewController那样方便的方法。那么最好的做法是什么?

how can I take notice when an NSWindow should or will get closed? I'd like to have something like the windowWillClose. Unfortunately NSWindowController does not have as much convenient methods as UIViewController has, for example. So what's the best practice to do that?

感谢

-f

Thanks
–f

推荐答案

根据 NSWindow 文档,一个窗口将会发布一个 NSWindowWillCloseNotification 即将关闭。您的控制器可以观察到此通知。

According to the NSWindow docs, a window will post a NSWindowWillCloseNotification notification when it is about to close. Your controller can observe this notification.

这篇关于如何在NSWindow关闭时收到通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆