如何处理可可中窗口的关闭按钮
我正在开发具有多个窗口的可可应用程序。窗口左角有一个红色的关闭按钮。我想处理关闭按钮的单击事件,以便我可以显示消息来询问用户是否要关闭窗口。如果用户接受关闭窗口,则应用程序将终止,否则向用户显示相同的窗口。 知道如何处理关闭按钮的点击事件吗???
I am developing cocoa application having multiple windows. There is a red close button on left corner of window. And I want to handle click event of close button so that I can show message to ask user whether he wants to close window or not. If user accept to close window then application will be terminated otherwise same window shown to user.
Any idea how can I handle click event of close button???
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
请查看 NSWindowDelegate 协议参考,您可以使用该方法正在寻找的是-
Please look at NSWindowDelegate protocol reference, the method which you are looking for is-
NSWindowController 有一个方法
NSWindowController has a method