Kinda Scruffy!

I’m crawling out of my cave to make a quick point before I get back to coding. In Cocoa, if you want to have your window shown when you click on its icon in the Dock, you need to add this method to the app delegate:

- (BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication
                    hasVisibleWindows:(BOOL)flag
{
    if( !flag )
        [window makeKeyAndOrderFront:nil];

return YES;

}

Seriously, this should be included in the default app delegate template generated by Xcode. I can’t think of a single reason why its not.

§651 · December 30, 2009 · Technology · Tags: · [Print]

1 Comment to “This Should Be Default”

  1. Adrian Sarli says:

    Thanks! I don't see how I was missing this!

Leave a Reply