문제

I've two TableViews (one SourceList and one Normal TableView). I'm not using ArrayControllers, just using:

- (id)tableView:(NSTableView *)aTableView
objectValueForTableColumn:(NSTableColumn *)aTableColumn
            row:(NSInteger)rowIndex;

- (NSInteger)numberOfRowsInTableView:(NSTableView *)aTableView;

this to display the Row Contents. But the Problem is that I have not only one TableView - I've more than one. So I have added another NSObject with this Codes inside. But the Content wont show.

Must I use ArrayControllers? Or can I show the Content of the Second TableView in another way?

도움이 되었습니까?

해결책

You don't have to use array controllers. In fact, they didn't even exist for most of Cocoa's life. The data source protocol works just fine (even better in some cases).

You can have separate controllers (one for each table) of course, but note you get a reference to the table view in each of the data source and delegate methods (aTableView in your source above), so you can give a different response depending on the table view. This way one controller can be responsible for both tables in your master/detail UI. In other words:

Table View: "What's column A of row 3?"

Your Controller: "Who's asking?"

Regarding your data not showing, did you instantiate your second controller and connect the problem table's data source to it? Did you ask the table to -reloadData? It's hard to help you with the limited information you've given.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top