NSTableViewDelegate not being called

I have an NSTableView class that sets the delegate and datasource in an initter, the numberOfRowsInTableView is called but none of the NSTableViewDelegate methods are called any tips on how to debug this?

Verify method signatures/override keywords.


Most of all confirm the delegate isnt null in a viewdidLoad method or some such.

That all checks out, in fact the - (NSInteger)numberOfRowsInTableView:(NSTableView *)aTableView is being called (this is where I check to see that the delegate is not null) so we know that the datasource is valid and I can see it is returning a positive value, however the method tableView:objectValueForTableColumn:row: is not being called. BTW, the table view pointer in the numberOfRowsInTableView numberOfRowsInTableView = self which is correct.

What type of table view do you have: view-based or cell-based?


My guess is that you have a view-based table. The objectValueForTableColumn() method is for cell-based tables. It doesn't get called for view-based tables. Implement NSTableView's viewForTableColumn() to support view-based tables. The alternative is to change your table to a cell-based table in Interface Builder, but for new development, you're better off using view-based tables.

> The objectValueForTableColumn() method is for cell-based tables. It doesn't get called for view-based tables.


This is incorrect. It gets called for view-based tables just fine. The result is used to set the objectValue property of the cell view if the cell view has a setter for such a property. NSTableCellView does, as do NSControl and its subclasses. See the declaration of the method in the NSTableView.h header for some documentation to this effect.

NSTableViewDelegate not being called
 
 
Q