如何获得行的前面选择的指数NSTableView
NSTableView的旧选择
方法
func tableViewSelectionIsChanging(notification: NSNotification) {
let index = (notification.object as! NSTableView).selectedRow
println(index)
}
func tableViewSelectionDidChange(notification: NSNotification)
let index = (notification.object as! NSTableView).selectedRow
println(index)
}
两种方法打印相同的值。如何获得因选择而发生变化的索引/行?
或者简单来说,如何让我喜欢
println("\(Selection changed from \(tableView.oldSelectedIndex) to \(tableView.newSelectionIndex)")
由于不调用tableView(tableView:NSTableView,shouldSelectRow row:Int)'当用户取消选择一行时,此技术将不起作用。相反,使用委托方法'tableView(_ tableView:NSTableView,selectionIndexesForProposedSelection proposedSelectionIndexes:IndexSet) - > IndexSet'。 –