• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSMutableArrayForKeyPath
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


  • Prev by Date: Re: Autorelease pools?
  • Next by Date: Re: Quitting screensavers programmatically
  • Previous by thread: Re: Quitting screensavers programmatically
  • Next by thread: Re: NSMutableArrayForKeyPath
  • Index(es):
    • Date
    • Thread