In code I have something like this:
let scrollView = NSScrollView()
let tableView = NSTableView()
override func viewDidLoad() {
super.viewDidLoad()
// Do view setup here.
tableView.delegate = self
tableView.dataSource = self
tableView.headerView = nil
scrollView.documentView = tableView
scrollView.hasVerticalScroller = true
self.view.addSubview(scrollView)
}
Both required methods (numberOfRows
and from the title) are declared. TableView is visible in view, scrollable and selectable. tableViewSelectionDidChange
works properly, I can get index of selected row by tableView.selectedRow
. But all cells are empty, because tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int)
called for none of the cells. I think, the problem is that tableView can't figure out which of the cells are visible right now. But I don't know what I should do with that