Key Value Observing of NSMutableArray inside an object
Key Value Observing of NSMutableArray inside an object
- Subject: Key Value Observing of NSMutableArray inside an object
- From: Mikael Wämundson <email@hidden>
- Date: Sat, 28 Jan 2012 22:28:00 +0100
Hi,
Background:
I have put an NSMutableArray (dataObjectArray) in my class DataObjectCollection. I have also made it possible to add objects to DataObjectCollection and hence the array by implementing
- (void)addDataObject:(DataObject *)theDataObject
{
NSIndexSet *loneIndex = [NSIndexSet indexSetWithIndex:[[self dataObjectArray] count]];
[self willChange:NSKeyValueChangeInsertion valuesAtIndexes:loneIndex forKey:@"dataObjectArray"];
[dataObjectArray addObject:theDataObject];
[self didChange:NSKeyValueChangeInsertion valuesAtIndexes:loneIndex forKey:@"dataObjectArray"];
}
In InterfaceBuilder I have put an ArrayController with ContentArray bound to "myAppDelegate".theDataObjectCollection.dataObjectArray
I have created bindings between the ArrayController and the columns of an NSTableView is
Problem:
Programmatically adding objects to my DataObjectCollection is not observed by the ArrayController.
I earlier had the dataObjectArray directly in my AppDelegate and then the key value observing worked.
Is there something I need to do with my class DataObjectCollection to make the observing work, i.e. to make it KVO compliant?
Thanks!
/Mikael
_______________________________________________
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