0
votes

I need some help why is not setting text and image to NsTableview cell in OS X development. Here is my demo code please help me out.

  1. First this is my story board in that i have taken tablelist, and image& text Table cell view. Find the screen shot. Storyboard Layout

  2. Now I am trying to setting the image and Textfield value of cell in NSTableview. And also my delegates are calling both here is my delegates code.

In NumberOfRowinTableView

{
    return [self.arrayData count];
}

In objectValueForTableColumn:(nullable NSTableColumn *)tableColumn row:(NSInteger)row

{

NSTableCellView *cellView = [tableView makeViewWithIdentifier:tableColumn.identifier owner:self];

DataDoc *bugDoc = [self.arrayData objectAtIndex:row];
cellView.imageView.image = bugDoc.thumbImage;
cellView.textField.stringValue = bugDoc.data.title;
return cellView;

}

Also getting values from my array, here is my screenshot

enter image description here

And this values are not set in tableview cell and getting following output

enter image description here

I know it is very minor mistake, but not getting the where is the issue to set text and image to cell.

1

1 Answers

0
votes

Ohhh god i found my mistake and got the solution.

  1. I have to give a identifier of Table cell view in Identity inspector

enter image description here

  1. Implement this method

    -(nullable NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(nullable NSTableColumn *)tableColumnrow:(NSInteger)row

Instead of this for View based tableview content mode.

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