class VIEwController: NSVIEwController,NSWindowDelegate { overrIDe func vIEwDIDLoad() { super.vIEwDIDLoad() let window: NSWindow? = vIEw.window window?.delegate = self } func windowWillClose(_ aNotification: Notification) { print("windowWillClose") }}
不幸的是没有任何事情发生,我能犯错什么?
文件:https://developer.apple.com/documentation/appkit/nswindow/1419400-willclosenotification
PS
我已经在没有找到解决方案的情况下阅读了这个问题:Handle close event of the window in Swift
class VIEwController: NSVIEwController,NSWindowDelegate { overrIDe func vIEwWillAppear() { super.vIEwWillAppear() vIEw.window?.delegate = self } func windowWillClose(_ aNotification: Notification) { print("windowWillClose") }}总结
以上是内存溢出为你收集整理的swift – 试图了解基于macOS Document的应用程序窗口何时关闭全部内容,希望文章能够帮你解决swift – 试图了解基于macOS Document的应用程序窗口何时关闭所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)