0
votes

I added an extra new label to a NSTableCellView in IB.

How can I wire up this new field, that I can access it like the builtin field "textfield" in tableView.make( withIdentifier ..

let cell = tableView.make(withIdentifier: "myCell", owner: self) as! NSTableCellView
cell.textField?.stringValue = data[row].firstName
cell.XXX?.stringValue = data[row].lastName

Second issue: I changed the height of the TableCellView in IB to 60 in the size inspector. The height changes in IB but not in the compiled program.

1
You have also to set the height in the Size Inspector of the table view.vadian
@vadian Tnx!, works fine. What, if I have two TableCellView types with a different height?mica
Then you need to implement the delegate method tableView(tableView:heightOfRow:vadian

1 Answers

1
votes

I solved one part of the question myself. For wiring up the new field, I created a subclass of NSTableCellView which I assigned to the TableCellView in the identity inspector.

To this class I could crtl-drag and create an outlet which I could use like this:

let cell = tableView.make(withIdentifier: "ItemCell", owner: self) as! ItemTableCellView
cell.textField?.stringValue = data[row].firstName
cell.outletForNewField.stringValue = data[row].lastName

The remainig problem is the size of the tableCellView