【问题标题】:Get the cell in a row and column (Cocoa)获取行列中的单元格(Cocoa)
【发布时间】:2019-05-15 14:16:18
【问题描述】:

我需要在不使用 tableview 函数的情况下获取指定行的列中包含的单元格。例如:

for a in 0...tableview!.numberOfRows {
    let column = tableview.tableColumns[2]
    let cell = cell in column at the row a
}

你有什么解决办法吗?

编辑:在可可中

【问题讨论】:

  • 使用0..<tableview!.numberOfRows
  • “细胞”是NSTableCellView吗?为什么不能使用NSTableView 方法view(atColumn:row:makeIfNecessary:)

标签: swift nstableview


【解决方案1】:

我解决了这个问题(检索每个单元格中项目的值),谢谢 Willeke

for a in 0...tableview!.numberOfRows-1 {
     let cell = tableview.view(atColumn: 2, row: a, makeIfNecessary: false) as? cella
     print(cell?.tipo.title)
}

【讨论】:

    猜你喜欢
    • 2021-09-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-10-20
    • 1970-01-01
    • 2016-08-28
    相关资源
    最近更新 更多