0

我在 IB 中为 NSTableCellView 添加了一个额外的新标签。

如何连接这个新字段,我可以像 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

第二个问题:我在尺寸检查器中将 IB 中 TableCellView 的高度更改为 60。IB 中的高度发生变化,但编译后的程序中没有。

4

1 回答 1

1

我自己解决了问题的一部分。为了连接新字段,我创建了一个 NSTableCellView 的子类,我将其分配给身份检查器中的 TableCellView。

对于这个类,我可以 crtl-drag 并创建一个可以像这样使用的插座:

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

剩下的问题是tableCellView的大小

于 2017-02-24T21:54:31.280 回答