Re: Setting NSObjectController's to file's owner
Re: Setting NSObjectController's to file's owner
- Subject: Re: Setting NSObjectController's to file's owner
- From: Chris Suter <email@hidden>
- Date: Thu, 15 May 2008 22:09:24 +1000
On 15/05/2008, at 5:21 PM, André Pang wrote:
I have a nib file containing an NSObjectController. The
NSObjectController's content is set to the File's Owner proxy
object, and this creates a retain cycle. (The file's owner never
gets deallocated because the object controller retains it, and the
object controller never gets deallocated because the file's owner
retains it as an IBOutlet.)
This is obviously a bad thing to do, but I always thought that it
was good design for views and controls to be bound to an
NSObjectController rather than the file's owner directly, since
NSObjectController then takes care of all the NSEditor protocol
stuff, you get auto-completion for model key names in Interface
Builder, etc. Is there a better method than what I'm doing?
I wouldn't set the content to file's owner. I think you should set the
content to an object that's contained by the file's owner, i.e. make
the file's owner a controller object that owns the NSObjectController
and has a reference/owns the content object.
- Chris
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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