Search code examples
macosnstableview

How to make NSTableView stop alternating rows on bottom?


I am new to macOS development, and I'd like to have my NSTableView rows alternate, but it looks quite ugly at the bottom where there are no more cells. The cells still alternate, but they're smaller than the rows I have, and thus look wrong.

I'd like the alternating rows to stop alternating at the bottom, but I can't seem to find information on how to do that. How can I stop the alternating rows at the bottom?

What it looks like:

enter image description here


Solution

  • Perhaps set the default row height to the height of your filled-in cells?

    In IB, or programmatically like so:

           tableView.rowSizeStyle = .custom
           tableView.rowHeight = the height of your cell