54

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

Kristina
  • 15,859
  • 29
  • 111
  • 181

4 Answers4

104

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

benrudhart
  • 1,406
  • 2
  • 13
  • 25
Brian Webster
  • 11,915
  • 4
  • 44
  • 58
42

You can also set the headerView programmatically without subclassing

[tableView setHeaderView:nil];
finnsson
  • 4,037
  • 2
  • 35
  • 44
8

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
Scott Harwell
  • 7,457
  • 2
  • 28
  • 41
1

Swift 5

tableView.headerView = nil
iossteps
  • 101
  • 4