Bindings NSArrayController is changing selectionIndex
Bindings NSArrayController is changing selectionIndex
- Subject: Bindings NSArrayController is changing selectionIndex
- From: Tod Cunningham <email@hidden>
- Date: Sun, 19 Sep 2004 19:19:11 -0400
The array controller is changing the value of its selectionIndex even
though "selects inserted objects" (selectsInsertedObjects) is off. I
setup an observer to watch the controllers selectionIndex and watched
it through an iteration of adding a new object (addObject).
[logArrayController addObserver:self
forKeyPath:@"selectionIndex"
options:NSKeyValueObservingOptionNew|NSKeyValueObservingOptionOld
context:nil];
One thing I noticed is that the observeValueForKeyPath method doesn't
contain any changed values for the selectionIndex. Both the old and
new values will show up as NSNull. So I look at the selectionIndex
value directly:
unsigned rowIndex = [logArrayController selectionIndex];
The method observeValueForKeyPath gets called twice during the
addObject operation:
1. selectionIndex changes to to end of end of the array
2. selectionIndex changes to NSNotFound
Should selectionIndex be changing?
- Tod
_______________________________________________
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