Xcode默认的向导生成的工程的带有关闭,最小化,最大化这几个按钮,
关闭按钮的事件,是让窗口最小化到Dock中,但当点击Dock却无法恢复,如果想点击关闭按钮后直接退出程序,可以监听NSWindowWillCloseNotification事件。
@implementation AppDelegate- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {[NSApp setDelegate:self];[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(closeWindow) name:NSWindowWillCloseNotification object:nil];}- (void)closeWindow {[NSApp terminate:self];}