I have an application, where a second NSWindow is opened by pressing a button. This new window is opened using [NSApp runModalForWindow:<myWindow&开发者_如何学JAVAgt;]. I want to be able to determine if the user closes the second window, in order to stop the modal.
There are several ways to be notified when a window closes.
- You can observe
NSWindowWillCloseNotificationnotifications from the secondNSWindowobject. - You can implement
NSWindowDelegatemethodswindowShouldClose:orwindowWillClose:. - You can subclass
NSWindowand override theperformClose:method. - You can add a Close button to the window, and connect it to an action.
Without more information, it's hard to advise which of these or other options would work best for you.
加载中,请稍侯......
精彩评论