Re: NSArrayController & Select inserted objects
Re: NSArrayController & Select inserted objects
- Subject: Re: NSArrayController & Select inserted objects
- From: David <email@hidden>
- Date: Mon, 6 Mar 2006 11:37:29 -0600
Wouldn't this present an issue if you have 2 NSArrayController's in
two different nibs observing the same NSArray and wish the selection
to point to the last object inserted?
On Mar 4, 2006, at 5:18 PM, Scott Anguish wrote:
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