Long time, no see!
That is what I wanted to say to Cocoa Binding.
A few years ago, it was a buzz word in Mac dev. society. However, due to iPhone, issues for Mac seems not so hot as they were used to be.
So, I wanted to remind myself of basic Mac programming skills. Anyway some new classes were added to Mac OS X 10.5, and there are lots of classes I didn’t use. So, NSDictionaryController was a good candidate!
Surprisingly there was no good explanation on how to use it.
NSDictionaryController is slightly different from other “controllers”.
First, I expect that I can just get a value for a key easily from the controller.
However, the way it is used is different from what I expected.
Its arragedObjects returns keys and values as array.
The screenshot above is when a sample program is just launched. Any of contents for the both controllers are not prepared yet. However, for NSDictionaryController, it shows some bogus data, while NSArrayController doesn’t show anything. What makes the difference?
Hmmm.. with NSArrayController and NSObjectController, it didn’t seem to show anything when there are not data yet. Let’s confirm it.
Although the keys are set in the Included Keys, they are not displayed.
To make NSDictionaryController work like NSArrayController on this, you should remove the items in “Included Keys”.