开发者

Closing the main window in cocoa?

开发者 https://www.devze.com 2022-12-15 02:15 出处:网络
How can i close a main window programatically in cocoa? I want to close my main window in a timer function(NSTimer) when a boolean value is set?

How can i close a main window programatically in cocoa?

I want to close my main window in a timer function(NSTimer) when a boolean value is set? How can I do that, I don't want to terminate my application, But would like to just 开发者_C百科close my window.


Something as simple as:

[NSTimer scheduledTimerWithTimeInterval:delay target:[NSApp mainWindow] selector:@selector(performClose:) userInfo:nil repeats:NO];

should work (where delay is an NSTimeInterval with your desired wait time).

0

精彩评论

暂无评论...
验证码 换一张
取 消