Re: NSWindowController
Re: NSWindowController
- Subject: Re: NSWindowController
- From: Chris Idou <email@hidden>
- Date: Mon, 15 Sep 2008 21:45:24 -0700 (PDT)
I see. But if some other object was the File's Owner, then how would you link the Window to the window Outlet of the Window Controller, which I presume is necessary?
--- On Mon, 9/15/08, Graham Cox <email@hidden> wrote:
> From: Graham Cox <email@hidden>
> Subject: Re: NSWindowController
> To: email@hidden
> Cc: email@hidden
> Date: Monday, September 15, 2008, 8:57 PM
> On 16 Sep 2008, at 1:44 pm, Chris Idou wrote:
>
> > That fixes it, but I thought the owner in this case
> was the owner of
> > the NSWindowController, not the File's owner of
> the NIB.
>
> -initWithWindowNibName:owner: expects you to pass the
> object that is
> represented by File's Owner in the NIB. Typically this
> is the window
> controller itself (in which case you can just use -
> initWithWindowNibName:, which implicitly passes
> 'self' as owner) but
> it need not be - it could be the document for example
> (personally I
> think this usage is probably unusual). The point is you
> have to be
> consistent - if you set up the NIB as if File's Owner
> is the
> controller, but then pass a document or some other object
> as the
> owner, there's a mismatch between your NIB and your
> code. Something's
> going to give ;-)
> >
> > NSWindowController has an "owner" property.
> But if you're saying the
> > owner is the File's owner, which is the
> NSWindowController itself,
> > then what is the owner property for?
>
> If you design your nib with some other object in mind as
> File's Owner,
> this object is returned by -owner. As I said I think
> it's unusual to
> do this, but you may have a hierarchy of controllers where
> you'd
> prefer them all to be managed by some common central object
> for
> example. There may be other situations but I've never
> used it this way
> so I don't know what they are. I suspect it would
> hinder the reuse of
> your controller/nib elsewhere though they aren't often
> all that
> reusable anyway.
>
> cheers, Graham
_______________________________________________
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