Re: Propagation of KVO through bindings
Re: Propagation of KVO through bindings
- Subject: Re: Propagation of KVO through bindings
- From: "Hamish Allan" <email@hidden>
- Date: Thu, 17 Apr 2008 10:32:25 +0200
On Wed, Apr 16, 2008 at 4:49 PM, Hamish Allan <email@hidden> wrote:
> [myArrayController addObserver:self forKeyPath:@"arrangedObjects"
> options:(NSKeyValueObservingOptionOld|NSKeyValueObservingOptionNew)
> context:nil];
> myDictionary = [[NSMutableDictionary alloc] init];
> [myDictionary bind:@"boundArrangedObjects" toObject:myArrayController
> withKeyPath:@"arrangedObjects" options:nil];
> [myDictionary addObserver:self forKeyPath:@"boundArrangedObjects"
> options:(NSKeyValueObservingOptionOld|NSKeyValueObservingOptionNew)
> context:nil];
> [...]
> KVO is not informing me of the change through the binding.
For anyone reading the archives, I have done some more digging and
found out what the problem is. It appears that NSArrayController does
not send proper KVO notifications for arrangedObjects -- whatever the
change, it reports the old and new values to be nil, which causes the
default implementation of bind:toObject:withKeyPath:options: to drop
the notification rather than forward it (as the old and new values are
equal). I would encourage anyone who uses NSArrayController to file a
bug (mine is rdar://problem/5870167).
Best wishes,
Hamish
_______________________________________________
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