Re-show my main Cocoa application window

Well, as simple and dumb as it may seem, this is my scenario:

  • Application window (there is only one main window) is minimized
  • User clicks something on the dock menu
  • We want to return this main window.

Simple?

Not really.

I tried to access my main window through:

  • [[NSApplication sharedApplication] mainWindow]
  • [[NSApplication sharedApplication] windows]

and then sending a message makeKeyAndOrderFront:, but it just is NOT displayed.

I even tried to show all the windows (yes, he still sees as “windows” one or two (hidden) sheets that I use ...), but still nothing.

Could you suggest a way, I could finally show this window, WITHOUT having to set the output anywhere?

I dont know; I'm probably too tired to notice, but this thing is almost nervous ...

+3
1

:

if([aWindow isMiniaturized])
{
   [aWindow deminiaturize:self];
}

, , .

?

:

for(NSWindow* win in [NSApp windows])
{
    if([win isMiniaturized])
    {
        [win deminiaturize:self];
    }
}

, NSWindowDidMiniaturizeNotification. , , .

+5

All Articles