NSArrayController, managedObjects and KVO
NSArrayController, managedObjects and KVO
- Subject: NSArrayController, managedObjects and KVO
- From: Brian Krisler <email@hidden>
- Date: Tue, 25 Mar 2008 15:04:07 -0400
Hello All,
I know this topic occurs often (I have searched the archive), but I am
still confused.
I have an NSArrayController in a NIB that contains Core Data Entities.
The represented entity has a two values, a boolean and a name, and
these are displayed in a table as a checkbox and text. (two columns).
All I would like to do is get notified with the check box is selected
and
have a way of determining with item was selected.
In my UI controller, I created an IBOutlet for my NSArrayController,
then in IB, I created the binding. Then in my UI controller's
awakeFromNib, I add and observer to my array controller.
While this appears to somewhat work, my observer gets notified
whenever a
row in my table is selected, I can not figure out how to determine if
the checkbox value changed. Since selected the text in the table also
fires a selection observable.
I have tried different values for my keyPath: arrangedObjects,
selectedObjects, selection
and in every instance, I get the same results. If I expand the keyPath
(i.e. selection.isSelected), I expected that to notify on the
selection of the isSelected boolean
field, however this is also not the case. I found I could put
anything in the keyPath
and get the same results. (selection.blah)
I found in the archive a thread indicating that for
NSArrayControllers, the source array,
not the managed object array should be watched. I have to admit, I
have been unsuccessful
in learning which binding is the source array, so I appear to be
missing something there.
At this point, I feel like I am just chasing my tail.
Thanks for any help or pointers to proper docs.
Brian
_______________________________________________
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