Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Monaj

macrumors regular
Original poster
May 24, 2009
193
0
Hi all,

I am trying to display content in NSTableView using NSMutableArrayController of NSMutableDictionary records.

I followed steps written below:

1. In application delegate class, I created an NSMutableArray object with name 'geniuses' and stored some NSMutableDictionary objects with keys: 'geniusName' and 'domain'.

2. I took an NSArrayController object in IB, binded its controller content property to application delegate class, and set its model key path to 'geniuses'. In attribute inspector pane set mode as class and class name as NSMutableDictionary. Added keys: 'geniusName' and 'domain' to it.

3. In IB I took a table view object. Binded its content property to array controller, controller key path set as arranged objects. Binded value property of its first column to array controller, controller key path set as arranged objects, model key path set as 'geniusName'. Binded value property of its second column to array controller, controller key path set as arranged objects, model key path set as 'geniusName'.

After following these steps when I tried to build and run the project I found un-populated table view.

You can find my code here : http://www.4shared.com/file/f9fW1klP/TableControllerHunt-1.html.

Can anyone suggest me where I may be wrong?

Thanks,

Monaj
 

kainjow

Moderator emeritus
Jun 15, 2000
7,958
7
When you modify your array directly the array controller doesn't know that you did, so it doesn't update. In order to update the array you can access it through Key-Value Coding:
Code:
[[self mutableArrayValueForKey:@"geniuses"] addObject:genius1];

However I would not recommend this for the initial setup of your array. Instead you can use @properties and assign your array to a temporary array.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.