NSArrayController and the single NSMutableArray
NSArrayController and the single NSMutableArray
- Subject: NSArrayController and the single NSMutableArray
- From: Glen Low <email@hidden>
- Date: Thu, 5 May 2005 08:11:41 +0800
Hi All
Must be doing something silly but can't get this to work.
I have an NSArrayController whose contentArray is bound to some
object's NSMutableArray (it's an ivar but I don't think this should
matter). I can easily make changes to the NSMutableArray through the
NSArrayController's add: and remove: methods, but cannot get any
programmatic changes to the NSMutableArray (addObject: etc.) to be
reported by the NSArrayController back to any bound views.
So I thought to "observe" things a little closer. I did an addObserver
to the keypath of the NSMutableArray, and true enough, changing the
NSMutableArray through addObject: etc. didn't get reported.
Quoting the spiel before observeValueForKeyPath:
"A value of NSKeyValueChangeInsertion, NSKeyValueChangeRemoval, or
NSKeyValueChangeReplacement indicates that mutating messages have been
sent to the array returned by a -mutableArrayValueForKey: message sent
to the object, or that one of the key-value-coding-compliant array
mutation methods for the key has been invoked, or that
-willChange:valuesAtIndexes:forKey:/-didChange:valuesAtIndexes:forKey:
has otherwise been invoked."
Surely addObject: qualifies as "one of the key-value-coding-compliant
array mutation methods"? (Or do I really have to
-willChange:valuesAtIndexes:forKey every time I touch the
NSMutableArray??)
If it helps any, I ran this on 10.4 prerelease 8A420.
Cheers, Glen Low
---
pixelglow software | simply brilliant stuff
www.pixelglow.com
aim: pixglen
_______________________________________________
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