Re: MyDocument and NSArrayController
Re: MyDocument and NSArrayController
- Subject: Re: MyDocument and NSArrayController
- From: email@hidden
- Date: Mon, 10 Jan 2005 22:04:44 +0000
> I would like to set up MyDocument (subclass of NSDocument) to get
> notification of changes in an NSArrayController. Is this possible? How
> can get notif's of when the selection changes and when objects are
> added or removed from the NSArrayController?
>
> Alex
I'm doing something similar with an NSApp delegate (my project is not document based). I set up KVC-compliant accessors to an array in my class and then created a binding to the NSArrayController's "selectedObjects" key path, like so:
[self bind:@"myArrayKey" toObject:theArrayController forKeyPath:@"selectedObjects" options:nil];
When a selection is made, my class gets an array containing the selected objects. Since my views only allow single selections, I just pull out the first array element.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden