I know that table sources need a data source to hold the data that the tableview will display.
Lets’ say that I’m going to make my AppController be the data source of my tableview and that I make the connection in interface builder. My question is since my actual data is going to be stored in an array,let’s call it myArray, when I set the data source in code should I do this
[tableView setDataSource:myArray]; or this [tableView setDataSource:self];
I’m confused about this. setting the data source with the keyword “self” would set it to the AppController if I’m not mistaken.
A table view data source must conform to the
NSTableViewDataSourceprotocol (calledNSTableDataSourceprior to 10.6).NSArraydoes not conform to this protocol, so you can’t use it as a data source.You need to implement the required protocol methods in your
AppControllerobject and assign yourAppControllerobject as the table’s data source.