Note that there are some explanatory texts on larger screens.

plurals
  1. POCocoa - multiple view-based NSTableViews
    primarykey
    data
    text
    <p>I am just beginning to teach myself cocoa, and I am running into a (probably simple) issue displaying multiple view-based NSTableViews with same delegate and controller (the App Delegate, in my case). I saw this post: <a href="https://stackoverflow.com/questions/505062/best-way-to-handle-multiple-nstableviews">Best way to handle multiple NSTableView(s)</a> but the method described still gives me errors - specifically</p> <p>Duplicate declaration of method 'numberOfRowsInTableView:' Duplicate declaration of method 'tableView:viewForTableColumn:row:'</p> <p>Obviously, the compiler isn't seeing that the different method declarations are for different table views.</p> <p>The code for the tableviews in the AppDelegate.m file is</p> <pre><code>@synthesize tableView1; @synthesize tableView2; -(NSUInteger)numberOfRowsInTableView:(NSTableView *)tableView1 { return 1; } -(NSUInteger)numberOfRowsInTableView:(NSTableView *)tableView2 { return 2; } - (NSView *)tableView:(NSTableView *)tableView1 viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row { NSTableCellView *resultForTable1 = [tableView1 makeViewWithIdentifier:tableColumn.identifier owner:self]; resultForTable1.textField.stringValue = @"This should appear in the first tableView"; return resultForTable1; } - (NSView *)tableView:(NSTableView *)tableView2 viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row { NSTableCellView *resultForTable2 = [tableView2 makeViewWithIdentifier:tableColumn.identifier owner:self]; resultForTable2.textField.stringValue = @"This should appear in the second tableView"; return resultForTable2; } </code></pre> <p>and in my AppDelegate.h file, I have:</p> <pre><code>@property (weak) IBOutlet NSTableView *tableView1; @property (weak) IBOutlet NSTableView *tableView2; </code></pre> <p>What am I doing wrong here?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload