Re: NSArrayController and threading
Re: NSArrayController and threading
- Subject: Re: NSArrayController and threading
- From: mmalcolm crawford <email@hidden>
- Date: Wed, 22 Dec 2004 15:26:22 -0800
On Dec 22, 2004, at 1:27 PM, Joe Chan wrote:
Inside fileLoaded:, I have to do something like this:
- (void)fileLoaded: (NSIndexSet *) indexes
{
Record *rec = [_recordList objectAtIndex: [indexes firstIndex]];
[rec willChangeValueForKey: @"thumbnail"];
[rec didChangeValueForKey: @"thumbnail"];
You would be better off ensuring that the record sends its own
notifications when the thumbnail actually changes. You may be able to
effect this automatically using
setKeys:triggerChangeNotificationsForDependentKey:
<http://developer.apple.com/documentation/Cocoa/Reference/Foundation/
ObjC_classic/Protocols/NSKeyValueObserving.html>
/* This doesn't work
[self willChange: NSKeyValueChangeReplacement valuesAtIndexes:indexes
forKey:@"thumbnail"];
[self didChange: NSKeyValueChangeReplacement valuesAtIndexes:indexes
forKey:@"thumbnail"];
*/
That wouldn't, since self doesn't have a property named "thumbnail"...
}
Which seems very strange to me. Is this a bug in the binding stuff, or
am I not understanding willChange:valuesAtIndexes:forKey: right?
I think you're not understanding it right. Try re-reading
<http://developer.apple.com/documentation/Cocoa/Conceptual/
KeyValueObserving/index.html>, and in particular "Automatic Versus
Manual Support".
mmalc
_______________________________________________
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