macoscocoanstableviewnstableheaderview

NSTableHeaderView adds a line?


For my first Mac app, I'm trying to make a simple window with just a table view. I enabled Headers but it adds an annoying line on top of my NSTableHeaderView:

enter image description here

I can't seem to find a property to remove it. I know it can be removed, because the Finder doesn't have it:

enter image description here

When I disable Headers, the border is not there. I should also note that the NSTableView is located inside an NSSplitView. Any ideas?


Solution

  • The problem exists because both the window frame and the table view's scroll view have a 1px border. Depending on your layout you can either set the borderStyle of the NSScrollView that encloses your NSTableView to NSNoBorder (note that this will remove the 1px border from all sides of the scroll view). Or you can move the scroll view up by 1px.