I do so wish there was a Complete Idiot's Guide to Cocoa Table Bindings … The 
very flexibility which I know must be their great virtue tends to obscure the 
clear path from my sight more often than not.  Forest, trees, trees, forest … 
Oh! Something shiny! 
---

So tonight I have an NSArrayController (RSTableArrayController) which I have 
populated with dictionary objects of the form:

[self.content addObject:[NSDictionary dictionaryWithObjects: [NSArray 
arrayWithObjects: key, [mvo valueForKey:key],nil] forKeys:[NSArray 
arrayWithObjects:@"label",@"value",nil]]];



For this simple two column data I have a two column table, using Table View 
Cells (I'm going to have visual objects in place of the 'label' later on).
I have set the identifier for the tableView columns very imaginatively to 
"label", and "value". 
The array controller is also < NSTableViewDataSource, NSTableViewDelegate >. I 
have implemented the following two delegate methods:

- (NSInteger)   numberOfRowsInTableView:(NSTableView *)aTableView {
        return self.content.count;
}

- (id)                  tableView:(NSTableView *)aTableView     
objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)rowIndex {
        NSString * identifier = [tableColumn identifier];
        NSDictionary * dict = [self.content objectAtIndex:rowIndex];
        NSLog(@"%s- [%04d] %@: %@", __PRETTY_FUNCTION__, __LINE__, 
identifier,[dict valueForKey:identifier]);
        return [dict valueForKey:identifier];
}

In the nib, I have an ArrayController object of the class described above 
RSTableArrayController. It is wired up as the delegate and dataSource for the 
tableView. 


And here is where I get lost time and again, tracing the appropriate path to 
the content and it's constituent data parts and binding them to the appropriate 
element in the tableView.

» Scroll View
        » Table View
                » Table Column
                        » Table Cell View
                                » Static Text
                                         Text Field Cell

Given that the delegate method is called  -[tableView: 
objectValueForTableColumn: row:]  I should expect to bind the arrayController's 
objectValue in the Bindings Inspector to the ?node?  in the object browser.  Do 
I need to do more than get that right?  

~ Erik, 
currently batting .034 in the bindings league ... 


_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to