For a background app (LSUIElement=1), what's the most el开发者_如何学Goegant way to make its 'preferences' or 'configuration' window pop up if a user double-clicks the app icon while it's already running?
This is assuming the user cannot access the app's prefs from anywhere else (such as menu bar status item menus).
I would suppose the ideal method would prevent the prefs window from showing on initial start, but is smart enough to show it on subsequent double-clicks on the app's icon.
Thanks
You just have to implement an NSApplicationDelegate
protocol method applicationShouldHandleReopen:hasVisibleWindows:
.
- (BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows:(BOOL)flag
{
// open pref pane
return NO;
}
would suffice; this delegate method is only called when the app is re-opened.
精彩评论