Re: how do I access another Nib's controller?
Re: how do I access another Nib's controller?
- Subject: Re: how do I access another Nib's controller?
- From: Mark Ritchie <email@hidden>
- Date: Mon, 26 Mar 2007 23:18:44 -0400
On 26-Mar-07, at 10:28 PM, Theodore Petrosky wrote:
If I change owner:self] to owner:@"TheController"] (and
TheController is the controller I want to talk to), how do I talk
to it.
I posted some code recently which shows how to do this:
Date: Wed, 14 Mar 2007 23:00:57 -0400
From: Mark Ritchie <email@hidden>
Subject: Re: Reloading a window from NIB
The steps go something like this:
- pick an object that's going to own the NIB file
- define an outlet in that object who's type matches the controller
you want to talk to
- in the nib file, set the File's Owner
- in the nib file, connect the outlet from File's Owner to the
controller
then load the nib file with something like:
[NSBundle loadNibNamed:@"NibFileName"
owner:object_who_owns_the_nib_file]
Assuming that everything worked correctly, the outlet you defined in
step 2 above
will *magically* be connected to the controller inside your NIB file.
Now you are free to message the controller directly.
Good luck!
Mark
__
Mark Ritchie
Cocoa and WebObjects Developer
Diamond Lake Consulting Inc.
Toronto, Ontario, Canada
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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