Re: Bindings
Re: Bindings
- Subject: Re: Bindings
- From: "I. Savant" <email@hidden>
- Date: Sat, 26 May 2007 22:53:15 -0400
Well, in all fairness, maybe I wasn't being clear (or rather,
precise).
If you have an object (say, a document) and it has an array called
_bServices with a controller bound to it via, say
"bServicesArrayAccessor", any changes you make directly to that array
(adding/removing) need to be enclosed in the appropriate notifications:
[self willChangeValueForKey:@"bServicesArrayAccessor"];
[_bServices addObject:someObject];
[self didChangeValueForKey:@"bServicesArrayAccessor"];
This will cause anything bound to your document via the
bServicesArrayAccessor key to note the changes (in this case your
controller).
Alternatively you could simply tell your array controller to -
addObject:someObject which would let the array controller to handle
all the notifications, etc. for you. Either way will do.
--
I.S.
On May 26, 2007, at 10:47 PM, Sandro Noel wrote:
OH!!! .... i get it ... :) Sorry for making you repeat ... i'll try
it :)
Sandro Noel
email@hidden
On 26-May-07, at 10:46 PM, I. Savant wrote:
_bServices is a NSMutableArray Object.
i'm adding the NSNet Services to it.
Okay, then ...
you're "changing the array behind the controller's back".
So ...
a) Call -willChangeValueForKey: and -didChangeValueForKey:
before/after changing the array, or,
b) Call -addObject: against your array controller.
:-)
If you're changing things behind your controller's back (which
handles KVO notifications for you), then it's up to you to
properly notify (-will/didChangeValueForKey:).
--
I.S.
_______________________________________________
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:
40gmail.com
This email sent to email@hidden
_______________________________________________
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