Re: Why doesn't -[NSArrayController selection] et al fire keyPathsForValuesAffectingKey?
Re: Why doesn't -[NSArrayController selection] et al fire keyPathsForValuesAffectingKey?
- Subject: Re: Why doesn't -[NSArrayController selection] et al fire keyPathsForValuesAffectingKey?
- From: Kyle Sluder <email@hidden>
- Date: Mon, 5 Apr 2010 13:30:32 -0700
On Mon, Apr 5, 2010 at 3:08 AM, Jerry Krinock <email@hidden> wrote:
> I already use MAKVONotificationCenter in this project, but I don't see the need for it here. In the array controller's -dealloc,
>
> [self removeObserver:self
> forKeyPath:@"selectedObjects"] ;
>
> Why is that perilous? (It seems to work.)
Because if NSArrayController also self-observes on @"selectedObjects",
you've removed that observation from under its feet.
MAKVONotificationCenter and OFBinding solve this problem by creating
separate objects, so they'll only ever register for a keypath once.
--Kyle Sluder
_______________________________________________
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