1

i have a very strange problem with NSTableView in XCode 4.2. I've set the datasource an delegate for the table. My table has 3 columns where each of the column has an identifier ("name","mugshot","lastSeen"). My delegate

-(id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row

is being called, but there is still the default value "TableViewCell" shown in the table cells. the method is implemented as follows:

- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
{
    NSMutableDictionary *villain = [self.villains objectAtIndex:row];
    id keyName = [tableColumn identifier];
    id objectValue = [villain objectForKey:keyName];
    return objectValue;
}

The tableColumnIdentifier is correct. I have no idea why the text is not showing.

br, martin

Martin
  • 790
  • 2
  • 9
  • 24

1 Answers1

6

in interface builder, make sure the Table Column contains a "Text Field Cell". if not, try dragging out a Text Field Cell on top of whatever cell is there.

this is assuming objectValue is an NSString?

Mike K
  • 2,227
  • 1
  • 12
  • 6
  • thanks! there was a static text cell inside. i replaced it with a text field cell and this solved my problem! – Martin Jan 08 '12 at 09:12