I have an NSTableView, with two columns. Whenever I add data to the table, both columns display the same data. How do I开发者_StackOverflow only update a specific column?
I'm doing Mac Dev btw.
This is the code I'm using:
- (id)tableView:(NSTableView *)streamView objectValueForTableColumn:(NSTableColumn     *)messageCol row:(int)row
{
return [[stream respond] objectAtIndex:row];
}
Thanks.
Check which column you're being asked to fill in in your implementation of tableView:objectValueForTableColumn:row:.  That's why it passes you the column! Quick example, since you seem to be ignoring the "check what column you're being asked to fill in" part:
- (id)tableView:(NSTableView *)tableView
       objectValueForTableColumn:(NSTableColumn *)column 
                             row:(int)row
{
    if ([[column identifier] isEqualToString:@"A"])
        return [columnArrayA objectAtIndex:row];
    if ([[column identifier] isEqualToString:@"B"])
        return [columnArrayB objectAtIndex:row];
    return nil;
}
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论