NSMutableArrayForKeyPath
NSMutableArrayForKeyPath
- Subject: NSMutableArrayForKeyPath
- From: Alan Donsky <email@hidden>
- Date: Thu, 18 Mar 2004 22:10:41 -0600
Anyone see why this is not working correctly.
This method is from an NSView subclass that i am trying to implement
bindings on. I overwrote the bind: method to store the controller and
key path in the instance variables controller and controllerKeyPath
respectively.
In awakeFromNib i call bind: ... which sets the controller to an array
controller and controllerKeyPath to @"arrangedObjects.name".
When the user presses a key, the following gets called in the custom
view. This does indeed lead to the appropriate calling of setName:
int the model class, but the argument is NOT the NSString s, but
rather an ENTIRE ARRAY of NSStrings (indeed, an array composed of all
the names in the array).
- (void)textDidChange:(NSNotification *)notification
{
NSTextFieldCell *c = [self selectedCell];
int r = [self selectedRow];
NSString *s = [c stringValue];
if(controller != nil)
{
[[controller mutableArrayValueForKeyPath:controllerKeyPath
replaceObjectAtIndex:r withObject:s];
}
}
Thanks
alan
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.