Re: NSDocument's -close method calls itself?
Re: NSDocument's -close method calls itself?
- Subject: Re: NSDocument's -close method calls itself?
- From: Quincey Morris <email@hidden>
- Date: Thu, 2 Jul 2009 11:52:10 -0700
On Jul 2, 2009, at 10:34, Sean McBride wrote:
I'm trying to find somewhere to undo what was done in my NSDocument
subclass' initializer. Specifically, to start/stop KVO
observation. It
seemed like 'close' would be a good place.
'close' isn't a good place, because it isn't necessarily called. If
you look at the Leopard Developer Release Notes:
http://developer.apple.com/releasenotes/Cocoa/AppKit.html
in the section entitled "Advice for Overriders of Methods that Follow
the delegate:didSomethingSelector:contextInfo: Pattern", you'll find a
nice little code snippet that happens to show you where to place code
that should execute just before a document closes:
if (shouldClose) {
// Here we can do all sorts of things with this document that's
about to be closed.
}
Does that help?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden