Hi all,

I have a general question about bindings - and I feel like there's something 
I'm not quite getting.

I have a custom view class with an array property.  I want to bind that array 
property to a model - which in my case is an array that is in a 
container/manager object.  The binding is done via  a custom view controller 
(in it's awakeFromNib). (calendar is the model object)

        [calendarView bind:@"events" 
                          toObject:calendar 
                   withKeyPath:@"events" 
                           options:options];



Now whenever "events" in the object calendar is modified "events" in 
calendarView is modified as well. 


In addition - observeValueForKeyPath... is getting called as well in the 
calendarView.

The problem is that if some items are removed from calendar's (the model) 
"events array" by the time observeValueForKeyPath in calendarView  gets called 
its "events" array has already been updated to reflect the model change.  

In observeValueForKeyPath..  I can get the indexes of the removed array items - 
but those indexes are no longer valid as the "events" array in calendarView 
have already been removed.

What is the best way for calendarView to get the items of the array that are 
going to be removed before they are actually removed? 

In the Change dictionary of ObserveValueForKeyPath I get a 
NSKeyValueChangeKindKey key and a NSKeyValueChangeIndexesKey - but no other 
keys that might contain the array before it was modified. 

Thank you,
Mazen Abdel-Rahman
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com

Reply via email to