Well Thanks everyone (especially Quincey). 

It works perfectly now. indeed "self" did the trick, and my previous runtime 
"unknown key path" binding errors were probably related to some other bug.

However, I must say that not being able to observe the changes of a set (or 
array) of values, is a major drawback to the mechanism. Indeed It seems a bit 
"heavy" to add all the items of an array to my observing list, but If I try to 
find another solution --- well --- they all come out at least as heavy. And one 
should not underestimate the comfort and elegance of such a solution.

Here's an example from my case:

I have that TableView, whose contents (a user list) is updated from a remote 
server (the listening code updates my Core-Data model, and my UI is bound to 
that model and updates accordingly).

However, in one column I have some boolean (say a "vote"). I need to raise up a 
badge, with the number of "YES" voters, whenever this number changes. This 
could happen either if a user has joined or left, or if a user changes his vote.

It would be lovely to observe the "vote" attribute of all "user"s array, and 
get called whenever one of them changes his/her vote.

I now need to devise a similar mechanism, or find a really weird way to track 
these changes.


On Feb 23, 2011, at 2:09 PM, Mike Abdullah wrote:

>> 
>>> I believe something is missing in the visual description in IB. when you 
>>> bind against the arrangedObjects of the ArrayController, you actually 
>>> indirectly specify that the array controller instantiates some Enumerator 
>>> (Iterator) and the Model Key Path is applied to that enumerator. But what 
>>> key-path do you ask from enumerator to bring back itself?.
>> 
>> It is a little funky, because IB shows the binding textually as 
>> ArrayController.arrangedObjects.x.y.x, but there's no actual key path like 
>> that. (An array property is illegal in the middle of a key path.) 
> 
> That's not strictly true. Arrays are just fine in key paths when used purely 
> for KVC. Something like this:
> 
> [myArray valueForKey:@"name"]
> 
> will return the @"name" value of all objects in the array. The problem arises 
> if you want to observe such a keypath, because an array itself cannot be 
> observed.

Motti Shneor, 
Senior Software Engineer and Team Leader,  Spectrum Reflections LTD.
Software Development for the Macintosh

Home/Office Address: 34 Emek-Ha-Ella St. Appt.1 Modiin, ISRAEL, 71723
Home/Office Tel/Fax: +972-8-9267730
iPhone: +972-54-3136621
Home eMail: [email protected]
Office eMail: [email protected]
---
ceterum censeo microsoftiem delendam esse
---










_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to