I'm making a Cocoa application with two windows. I want to hide both of these windows, call some screen capture functionality and then restore the windows. I use
[mainWindow orderOut:self];
to hide the window, but when I do this, the whole application closes. In my AppDelegate I have the function:
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication*)sender
{
return YES;
}
Am I hiding the window incorrectly? Why does the AppDelegate think the window has been closed when using orderOut?
My app works perfectly without using the method above in AppDelegate, I added it in as a final step to terminate the application when I actually close all of the windows. Can anyone suggest how to make my windows temporarily invisible without closing the application?