Binding / Key-Value Observing problem...
Binding / Key-Value Observing problem...
- Subject: Binding / Key-Value Observing problem...
- From: "James Pillars" <email@hidden>
- Date: Mon, 18 Jun 2007 14:43:00 +1000
Hi there,
I'm having a problem with some KVO stuff. I'm a bit new to it all, but
I'd appreciate any help.
I set up a small application, and, mostly using Interface Builder I
created bindings between an array of objects (say, called ItemObject)
stored in ItemController. I'm using an NSArrayController to bind this
to an NSTableView. There are a few buttons so that you I can
add/remove an ItemObject to/from the list. In the NSTableView you can
also edit (ie change the string values) of some of the properties of
an ItemObject. There is a further example of how this works below.
So this works all fine.. However, I'm now trying to observe changes to
these objects from another controller, using KVO.
Well, here I think I need to show a sample of these objects:
@interface ItemObject
{
NSMutableDictionary properties;
}
...
@end
@interface ItemController
{
NSMutableArray items; // array of ItemObject
}
...
@end
The NSArrayController (called 'itemArrayCtrl') is connected to the
ItemController via an NSObjectController (called
'itemControllerAlias').
A column in the NSTableView is bound to the itemArrayCtrl key
arrangedObjects with key path properties.name (which is a string).
Now in a totally different controller, I am trying to observe changes
to this array, AND the objects stored in it. I seem to be able to do
the first part quite easily:
[itemController addObserver:self forKeyPath:@"items" options: ...]
OR with
[itemArrayCtrl addObserver:self forKeyPath:@"arrangedObjects" ...]
However, I do not get notifications for when an object in the array is
modified.. Such as the properties.name is changed in a row of the
NSTableView that is bound to the array.
I've tried things like:
[itemArrayCtrl addObserver:self
forKeyPath:@"email@hiddenrties" ...]
But that sort of thing doesn't seem to work.
Does anyone have any idea? I'm totally lost!
Thanks all,
J
_______________________________________________
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