gpt4 book ai didi

cocoa - NSWindowController 的红色关闭按钮的事件

转载 作者:行者123 更新时间:2023-12-03 16:01:36 26 4
gpt4 key购买 nike

如何处理单击 NSWindowController 的红色关闭按钮的事件?

询问的原因是我在新的 NSWindowController 窗口中播放视频,当用户单击红色关闭按钮时,音频继续播放,因此我想使用该事件关闭视频。

最佳答案

使你的NSWindowController子类符合NSWindowDelegate协议(protocol)并成为相应窗口的委托(delegate)。完成后,实现:

- (void)windowWillClose:(NSNotification *)notification {
// whichever operations are needed when the
// window is about to be closed
}

在你的NSWindowController子类中。

关于cocoa - NSWindowController 的红色关闭按钮的事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5865492/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com