I'm using an NSTableView with usesAlternatingRowBackgroundColors set to true.
As soon as I
- Add many columns, e.g., 15 and
- Set the Cell Spacing height to something > 0
the table shows a visual glitch, where the alternating rows are not equally distributed in height:
This happens only under macOS Big Sur. macOS Mojave and macOS Catalina work fine. I've experimented with almost any combination of settings and styles, using latest Xcode 12.4.
My ViewController is fairly simple:
class ViewController: NSViewController {
@IBOutlet weak var tableView: NSTableView!
override func viewDidLoad() {
super.viewDidLoad()
for columnIndex in 0..<15 {
let tableColumn = NSTableColumn(identifier: NSUserInterfaceItemIdentifier(rawValue: "\(columnIndex)"))
tableColumn.title = "CustomColumn \(columnIndex)"
tableColumn.width = 150
tableView.addTableColumn(tableColumn)
}
}
}
And the configuration of the NSTableView in Interface Builder is also quite boring, except for the adjusted cell spacing height:
It would be great if someone could confirm the issue and possibly share any workaround for that.
You can find a demo project at https://github.com/fheidenreich/table-test

