Skip navigation.
 
mlNSArrayController, managedObjects and KVO
FROM : Brian Krisler
DATE : Tue Mar 25 20:04:07 2008

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

Related mailsAuthorDate
mlNSArrayController, managedObjects and KVO Brian Krisler Mar 25, 20:04
mlRe: NSArrayController, managedObjects and KVO Quincey Morris Mar 25, 21:29
mlRe: NSArrayController, managedObjects and KVO Eric Crichlow Mar 25, 23:17