草庐IT

windowWillClose

全部标签

swift - 尝试了解基于 macOS 文档的应用程序中的窗口何时关闭

我想知道窗口何时关闭,我实现了这段代码:classViewController:NSViewController,NSWindowDelegate{overridefuncviewDidLoad(){super.viewDidLoad()letwindow:NSWindow?=view.windowwindow?.delegate=self}funcwindowWillClose(_aNotification:Notification){print("windowWillClose")}}不幸的是什么也没发生,我哪里做错了吗?文件:https://developer.apple.com