Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

rossipoo

macrumors regular
Original poster
Jun 7, 2009
109
0
I want to use a subclassed NSTextFieldCell, which I got this working before in a different project, but now I can't figure out want could be wrong. For now I simplified it to just an NSImageCell, and that won't work either.

Code:
- (id) tableView:(NSTableView *)aTableView
objectValueForTableColumn:(NSTableColumn *)aTableColumn
			 row:(NSInteger)rowIndex {
	
	id cell = [[[NSImageCell alloc] init] autorelease];
	[cell setImage: [NSImage imageNamed: @"Cool.pdf"]];
	return cell;
}	

- (void) tableView:(NSTableView *)aTableView
   willDisplayCell:(id)aCell
	forTableColumn:(NSTableColumn *)aTableColumn
			   row:(NSInteger)rowIndex {
	
	NSLog (@"%@", [aCell class]);
}

The Log shows that aCell's class is an NSTextField, and the table view itself shows the description coming from the NSImage instance. I feel like I must be missing something obvious, but I don't know what.
 

kainjow

Moderator emeritus
Jun 15, 2000
7,958
7
Usually you set the cell in the nib by clicking through the scroll view > table > column > cell. Otherwise, set it via NSTableColumn (setDataCell:) in something like awakeFromNib.
 

rossipoo

macrumors regular
Original poster
Jun 7, 2009
109
0
Hey, thanks champ.

That's what it was exactly. I figured there must be some small detail I was missing. I looked up some NSTableView tutorials on the web, but I didn't find any that mentioned the fact.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.