How would you draw the dock icon when you clicked?

This seems like one of my previous questions that never got an answer. I would like the Dock icon to use the method makekeyandorderfrontto open the main window after closing it. I did this using the button that opens the window, but I don’t know how to do it using the Dock icon, because you cannot connect to it in the interface builder.

+3
source share
2 answers

There is a delegate method in the NSApplication delegate:

- (BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows:(BOOL)flag;

which you can use to handle clicks on the application icon in the dock. See its documentation .

+14
source

:

, , -, , , . , -, , .

delagate

- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication {
    return YES;
}

, . , , , .

+5

Source: https://habr.com/ru/post/1709952/


All Articles