I've looked on SO for examples of using Key Value Observing with an NSArray
(or NSMutableArray
) and apparently you need to use an NSArrayController
(which unlike KVO
I'm not familiar with), but I haven't found concrete examples of how to do this. Can anyone explain with some sample code?
For instance, if I have a GameModel
which represents its player names with an NSArray (playerNameArray)
of NSStrings
. I want to observe those strings (the view controller observes the model's data) to update various things in the view.
How do I get notification that the player name array has changed?
EDIT: Does the iOS SDK even support NSArrayController
? If not, is there another way?