I did try – windowDidExpose:
but it didn't work. What do I have to try for this?
My window is a utility window.
-- edit for more clarity --
What I want are:
viewWillAppear
viewWillDisappear
viewDidLoad
viewDidUnload
in Cocoa Touch.
Very old question, but only for documentation purpose:
Track open: In your windows controller override the method:
-(void)showWindow:(id)sender
{
//add this for track the window close
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(windowWillClose)
name:NSWindowWillCloseNotification
object:nil];
[super showWindow:sender];
//do here what you want...
}
Track close: Implement the method
-(void)windowWillClose
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
//do here what you want...
}
There is windowDidClose:
, but that probably only refers to closing; if you're sending your window an orderOut:
message, I don't think that counts.
You probably need to either just track it from whatever code you're ordering the window in and out from, or subclass the window's class and override methods like makeKeyAndOrderFront:
and orderOut:
(whatever you're using, at least) to post custom notifications before calling up to super
.
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