I want to re-show the main window after closed when click my app icon on dock. Anyone know how to do it ? Thanks in advance.
In @implementation:
Make step 1
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification{
[_window setReleasedWhenClosed:NO];
}
where _window
is your window that will reopen in future
Make step 2
- (BOOL)applicationShouldHandleReopen:(NSApplication *)sender hasVisibleWindows:(BOOL)flag{
[_window setIsVisible:YES];
return YES;
}
where _window
is your closed window
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With