NSTableView Multiple textfield cells in one cell, driving me nuts.

Discussion in 'Mac Programming' started by detz, Jan 29, 2009.

  1. macrumors 65816

    Jun 29, 2007
    I've been trying to get this to work all day and I just can't get it. I have two items showing in the cell but I can't figure out how to change the text once it's there.


    Would I have to do something in this method?

    - (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex{
    NSLog(@"%@ - %d",aTableColumnrowIndex);
        if ([[
    aTableColumn identifierisEqualToString:@"Title"]){
    //something to change the values?
        return [
    title objectAtIndex:rowIndex];
    The picture shows what I'm trying to do, I need to change both of those values under Title.

    Attached Files:

  2. Moderator emeritus


    Jun 15, 2000
    There are two ways. One would be to use your current method and return some object that stores both values (such as a dictionary) and then retrieve that dictionary in your custom cell via the objectValue method (or override the setObjectValue: method and update your text fields there), or write accessor methods to those text fields in the cell and set them appropriately in tableView:willDisplayCell:forTableColumn:row:

Share This Page