54
votes

How do I hide an NSTableView header completely, so that it does not take any space up?

4
+1 for asking a good question.ArtOfWarfare

4 Answers

104
votes

In Interface Builder, select the table view, open the attributes inspector (alt-command-4), and uncheck the "Headers" checkbox in the "Columns" section.

41
votes

You can also set the headerView programmatically without subclassing

[tableView setHeaderView:nil];
8
votes

To do this programmatically, you can subclass NSTableView (or any NSTableView child class) and return nil for the headerView variable:

@interface AppTableView : NSTableView {

}

@end

@implementation AppTableView

- (NSTableHeaderView *)headerView{
    return nil;
}

@end
1
votes

Swift 5

tableView.headerView = nil