Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

KVO question

0 views
Skip to first unread message

LPT

unread,
Dec 1, 2009, 6:50:01 PM12/1/09
to
I thought I had a handle on KVO, but in reviewing some old code while
writing some new code, I think I may have been missing a bit. Here are
my questions:
I'm using an NSArrayController to manage an NSArray which contains a
number of NSMutableDictionary's. When I add NSDictionary's to the
NSArray, I use the NSArrayController's addObject: method. If I need to
alter anything in the mutabledictionary, I retrieve a pointer to it
directly from the NSArray, alter it, while wrapping the change with
willChangeValueForKey and didChange...
This seems to work and the NSTableView that uses the NSArrayController
is updated correctly. Question 1: Is this the correct way to do this?

In some of my old code, I had been adding mutabledictionarys directly to
the NSArray, wrapping it with willChange... and didChange... to ensure
the KVO updates. Question 2: Is this the wrong way to do this?
Thanks

0 new messages