Need notification of applicationWillUnhide
I'm using Lion, and the applicationWillUnhide - applicationDidUnhide application delegate methods are not being called when expected.
I'm miniaturizing the app to the doc, and then开发者_开发知识库 clicking on the dock icon again, but they are not being called, and the application is being deminiaturized correctly.
Maybe this does not count as hiding? How can I catch this event? Your help is greatly appreciated, Jose.
You can’t minimise an application on OS X, only hide it. To observe your NSApplication
’s hidden state use NSApplicationDidHideNotification
and NSApplicationWillUnhideNotification
. If these notifications don’t appear to be sent correctly, you’ll need to show us some code.
Or do you actually mean minimising windows? You’ll have to observe NSWindowWillMiniaturizeNotification
/NSWindowDidMiniaturizeNotification
and NSWindowDidDeminiaturizeNotification
for that (as per the NSWindow class reference). Remember that you can pass nil
for the object parameter of -[NSNotification addObserver:selector:name:object:]
to observe the minimisation state of all your application’s windows.
精彩评论