Question

I have a NSTableCellView that has a simple NSTextField and an NSImageCell.

NSTableCellView *cell = [tableView makeViewWithIdentifier:@"List" owner:self];
cell.textField.stringValue = name;
cell.imageView.image = [NSImage imageNamed:@"image1.png"]; (or image 2,3, etc)

Later, when I select a row from the table, I'd like to be able to see the name of the image. If I preload the image from IB, I can use:

NSTableColumn *column = [self.tableView tableColumnWithIdentifier:@"List"];
NSCell *cell = [column dataCellForRow:row];
NSLog(@"TableView image:%@",cell.image.name);

This shows the IB Name - e.g. NSEveryWhere

But when I load the images at run time, the same statement results in (null).

Any help would be appreciated. Please note that this is for OS/X - however, for future use, I would appreciate iOS ideas as well. Thanks

Was it helpful?

Solution

i think you should use cell.imageView.image.name rather than logging cell.image.name

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top