views:

106

answers:

0

I am trying to get the old and new values of the objects in my NSArrayController using KVO. The values passed into the change dictionary are nil though.

I have an NSArrayController and I have a class Model with a property name that use cocoa's @property and @synthesize to insure that they are KVO compliant.

@property (retain) NSString * name
@synthesize name

I add observer to the controller to observer changes with this:

[self.controller addObserver:self forKeyPath:@"arrangedObjects.name"
     options:NSKeyValueObservingOptionNew|NSKeyValueObservingOptionOld context:nil];

This should return the old and new values but they are nil. Anybody know why?

If I observer on a single, specific model, it works just fine. is my keyPath wrong? I tried and failed with:

forKeyPath:@"arrangedObjects.name" 
forKeyPath:@"contentArray.name" 
forKeyPath:@"content.name" 
forKeyPath:@"selection.name" 
forKeyPath:@"selectedObjects.name"