For a long time, Apple recommended calling -unbind in a view's -
dealloc
method. With the introduction of garbage collection, this had to
change. The new Apple recommendation became:
Apple highly discourages doing work in -finalize, so this seems like a
good idea.
However, if you use 10.5's new NSView API:
- (BOOL)enterFullScreenMode:(NSScreen*)screen
withOptions:(NSDictionary*)options
then the unbinding is triggered, because viewWillMoveToSuperview: is
called with nil. Obviously, we don't want everything unbound, just
because we are fullscreen.
Now I don't know where to call -unbind. Doing it in -finalize seems
dangerous, what with Apple discouraging it so much.
This is <rdar://5497135> BTW.
I haven't played around with viewWillMoveToSuperview:, but I do a fair
amount of work in viewWilMoveToWindow: and viewDidMoveToWindow.
Perhaps those APIs will give you the proper hook?