Viper OS X
Viper OS X

Reputation: 283

cocoa open a window two times

If I close my app with the red x in the top left corner I can't reopen it. Why and how can I change this.

I want to open the windows after closing again and again.

Upvotes: 0

Views: 119

Answers (1)

Justin Boo
Justin Boo

Reputation: 10198

If your window's behavior is checked "release When Closed" you need to uncheck it. Go to Attributes Inspector, here:

Screenshot

You didn't wrote how are you doing reopening window. So if You want to reopen window on dock icon click you can do it simply like this:

- (BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows:(BOOL)flag
{
    if (flag) {
        return NO;
    } else {
        [windowOutlet orderFront:self];
        return YES;
    }   
}

Upvotes: 5

Related Questions