How do you make the Application window open when the dock icon is clicked?

后端 未结 6 2054
余生分开走
余生分开走 2020-12-07 22:50

I\'m surprised this doesn\'t happen automatically, but I would like my applications window to open automatically when the Dock icon is clicked.

Just to clarify, when

6条回答
  •  生来不讨喜
    2020-12-07 23:06

    This is what I'm doing to get the main window of a non-document based app back to screen once it has been closed. I know this might not be the right way to do it but It's working for me so far.

    Implemented this on the AppDelegate, window is defined as instance variable of the same object.

    - (BOOL) applicationShouldOpenUntitledFile:(NSApplication *)sender
    {
        [window makeKeyAndOrderFront:self];
        return NO;
    }
    

    If anyone has a better solution please reply. Thanks!

提交回复
热议问题