Cocoa: programmatically display the main window after closing it with X

I want to programmatically reopen the main Cocoa application window after the user closed it with the X button. I know this is still somewhere in memory, but I don't know where.

+3
source share
2 answers

If you use the default Cocoa application template, your application delegate has a link to a window located in MainMenu.xib. You can just call

[window makeKeyAndOrderFront:self];

possibly in the IBActionmenu item invoked to reopen the window. Note: make sure that the “Release at close” and “Single snapshot” checkboxes are not checked in IB.

+8
source

, , , . , , , . , , , , , , .

, , . .

+6

All Articles