Re: NSArrayController & Select inserted objects
Re: NSArrayController & Select inserted objects
- Subject: Re: NSArrayController & Select inserted objects
- From: Scott Anguish <email@hidden>
- Date: Sat, 4 Mar 2006 18:18:40 -0500
I believe this is designed only to work with insertions/additions
made through the array controller directly.
if this isn't clear in the doc, please file a bug
On Mar 4, 2006, at 12:57 PM, David wrote:
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
_______________________________________________
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