0

I'm developing an NSTableView (cell based) app based in Xcode5 and I want to get each NSTextFieldCell's cell for determining row's height this is my code so far

- (CGFloat)tableView:(NSTableView *)tableView heightOfRow:(NSInteger)row{

    if (tableView == _tableView) {

        NSTableColumn *column = [_tableView tableColumnWithIdentifier:@"Consecutivo"];
        NSTextFieldCell *cell = [column dataCellForRow:row];



        NSInteger occurences = [Functions FindOccurencesOfText:@"\n"
                                              inWholeText:cell.stringValue];

        if (occurences > 0) { return occurences * 17; }
        else { return 17; }

    }
    else                         { return 17; }
}

but I cant get string's cell value

even if I put

NSLog(@"text: %@", cell.stringValue); 

all I get is

text: 

any help I'll appreciate

Jesus
  • 8,456
  • 4
  • 28
  • 40
  • Make sure that cell is not nil, aka, `NSLog(@"cell = %@", cell)` would be useful. You can also check it out by setting a breakpoint, (click to the left of the line number) – Ethan Aug 17 '14 at 21:24
  • it's weird, for some reason, my NSTextFieldCell got my first old data after refilling my NSTableView with some other new data, my solution was pointing at my dataset with the row parameter and everything worked fine then – Jesus Aug 18 '14 at 14:37

0 Answers0