我当前正在使用以下代码显示模式窗口:
[[NSApplication sharedApplication] runModalForWindow:mainWindow];
但是,当我关闭此窗口时,其他窗口仍然处于非活动状态。我如何运行stopModal
使用“red x”关闭窗口时的方法?
谢谢你,
Michael
您可以为窗口创建一个委托并让它响应
-(void)windowWillClose:(NSNotification *)通知 or the
- (void)windowShouldClose:(NSNotification *)通知像这样的方法:
- (void)windowWillClose:(NSNotification *)notification {
[[NSApplication sharedApplication] stopModal];
}
See Mac 开发中心:NSWindowDelegate 协议参考 http://developer.apple.com/mac/library/documentation/Cocoa/Reference/NSWindowDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/intf/NSWindowDelegate
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)