Re: NSArrayController using an external NSArray?
Re: NSArrayController using an external NSArray?
- Subject: Re: NSArrayController using an external NSArray?
- From: Ron Aldrich <email@hidden>
- Date: Thu, 19 Apr 2007 17:25:24 -0700
On Apr 19, 2007, at 5:12 PM, Todd Heberlein wrote:
Note: I have found this problem mentioned in the "Troubleshooting
Cocoa Bindings" in the "Cocoa Bindings Programming Topics"
document. I am still trying to grok it, however.
You're having this problem, because NSMutableArray, in itself, isn't
KVO compliant.
You can, however, request a proxy for the array which is KVO compliant.
Instead of:
[myArray addObject: anObject];
use
[[self mutableArrayValueForKey: @"myArray"] addObject: anObject];
The trick here is that the object returned by
mutableArrayValueForKey: is not actually your NSMutableArray, it's a
proxy to it which contains the extra information and code needed to
make it KVO compliant.
Ron Aldrich
Software Architects, Inc.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden