NSArrayController & Select inserted objects
NSArrayController & Select inserted objects
- Subject: NSArrayController & Select inserted objects
- From: David <email@hidden>
- Date: Sat, 4 Mar 2006 11:57:52 -0600
I am unable to get the NSArrayController to update its selection when
implementing KVO compliance manually.
The "Selects Inserted Objects" is true as it is the default.
The following code does not change the selection( data is an
NSMutableArray):
- (void)addRecord:(id)aRecord
{
NSRange range = NSMakeRange([data count], 1);
NSIndexSet *indexes = [NSIndexSet indexSetWithIndexesInRange:range];
[self willChange:NSKeyValueChangeInsertion valuesAtIndexes:indexes
forKey:@"data"];
[data addObject:aRecord];
[self didChange:NSKeyValueChangeInsertion valuesAtIndexes:indexes
forKey:@"data"];
}
If I addObject to the array controller itself it does update the
selection. Also using setSelectionIndex works as well.
Is there a reason the manual way does not work?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden