Doing something wrong with bindings, can't find out what

I've a mutable array that holds instances of a model object. That model object has several properties one being "name". I have no problems initialising or populating the mutable array.

I've a window with a drawer. I added a table to the drawer, the idea being that the drawer would use the table to display several instances of the model object.

I added an nsarraycontroller to the xib of the window that has a drawer. In the Array Controller Properties I've set the Object Controller to be an instance of the model class. On the Array Controller Bindings I set the Controller Content to point to the File Owner and set the Model Key Path to the name of the array.

On the table, I bind the content to the Array Controller, the Controller Key to arrangedObjects and Model Key Path to name.

My problem is that although the mutable array has been properly initialised and populated I can't see a single entry on the table on the drawer. Am I missing something here?

Answers


Two possibilities:

First: you might have bound the wrong thing (your description here is a bit ambiguous). Bind each table column's "values" to the array controller's @"arrangedObjects.propertyName" (like arrangedObjects.firstName for the First Name column, etc.). There are alternative ways to bind the whole table, but you probably aren't binding the column's values, just the table's content.

Second: it's also possible the accessor to your model object isn't KVO compliant. Make sure proper KVO notifications wrap your setter accessor for your model array. If you've @synthesize'd it, all should be well. If you've hand-coded your accessors, all might not be well. :-)


Need Your Help

Checking the availability of a username in asp.net using ajax

c# jquery asp.net ajax

I am having following textbox in my aasp.net page. And user enters any username in it and I want ajax to check the availability and show the success or failure message in the label as the user leav...

Buttons do not work in Lua (Corona)

android lua corona

I have create a game, and the game portion of it is still being worked on. However, the game does work enough to be played. I used a tutorial on corona to learn how to make the menu. The menu displ...