我在IB中的NSTableCellView中添加了额外的新标签。
如何连接这个新字段,以便可以像访问tableView.make中的内置字段"textfield“一样访问它( 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中更改,但在编译后的程序中不会更改。
发布于 2017-02-25 05:54:31
我自己解决了问题的一部分。为了连接新字段,我创建了NSTableCellView的子类,并将其分配给身份检查器中的TableCellView。
对于这个类,我可以按下crtl并创建一个出口,我可以这样使用它:
let cell = tableView.make(withIdentifier: "ItemCell", owner: self) as! ItemTableCellView
cell.textField?.stringValue = data[row].firstName
cell.outletForNewField.stringValue = data[row].lastName剩下的问题是tableCellView的大小
https://stackoverflow.com/questions/42446136
复制相似问题