Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How would you make The Dock Icon show a window when clicked?

I would like the Dock Icon to use the method makekeyandorderfront to open the Main window after it has been closed. I have done this with a button opening a Window but I don't know how to do it with the Dock Icon because you can't make a connection to it in interface builder.

like image 646
Joshua Avatar asked Nov 29 '22 07:11

Joshua


1 Answers

There's a delegate method in NSApplication's delegate:

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

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

like image 135
Nikolai Ruhe Avatar answered Dec 18 '22 21:12

Nikolai Ruhe