Re: Post notification among several nib files?
Re: Post notification among several nib files?
- Subject: Re: Post notification among several nib files?
- From: "Kyle Sluder" <email@hidden>
- Date: Sat, 8 Mar 2008 13:50:21 -0500
On Sat, Mar 8, 2008 at 7:09 PM, Scott.D.R
<email@hidden> wrote:
> Because it seems impossible to post a notification
> from an object in a Nib file to another object in another Nib file.
> I am wondering how to accomplish these:
Notifications aren't posted directly to interested objects... perhaps
you were thinking of messages? It sounds like you're trying to set
the actions of the controls to objects in another nib, and found out
the hard way that this won't work.
You have two options:
1) Wire the action of the controls to some object in the same nib, and
have that post notifications to the default NSNotificationCenter. The
object in the other nib listens for these notifications and acts
appropriately.
2) Use bindings. Bind the controls to some object that is accessible
from both nibs (the application delegate is usually a good place to
put this). No notifications are required. Bindings are typically the
easier way to go about this, but they do require your model objects to
be KVO compliant.
HTH,
--Kyle Sluder
_______________________________________________
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