I have an NSTableView with about 6 columns. All the columns are text but the first one I want as an NSImage. Reading through the docs it seems that a cell can be text or image initWithText or initWithImage. So in a delegate method for the tableview I had it look at the identifier and if it was the image it would make an image Cell and return that instead of the default which seems to be the text Cell. The end result is a blank column?
Code:
-(id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row{
Item *newItem = [tableViewItemList objectAtIndex:row];
NSString *identifier = [tableColumn identifier];
if ([identifier isEqualToString:@"image"]) {
NSCell *imageCell = [[NSCell alloc] initImageCell:newItem.image];
return imageCell;
}
else
return [newItem valueForKey:identifier];
}
Last edited: