Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hiding NSTableView header?

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

like image 433
Kristina Brooks Avatar asked Aug 18 '10 16:08

Kristina Brooks


4 Answers

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

like image 138
Brian Webster Avatar answered Nov 13 '22 01:11

Brian Webster


You can also set the headerView programmatically without subclassing

[tableView setHeaderView:nil];
like image 32
finnsson Avatar answered Nov 13 '22 01:11

finnsson


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
like image 27
Scott Harwell Avatar answered Nov 13 '22 02:11

Scott Harwell


Swift 5

tableView.headerView = nil
like image 1
iossteps Avatar answered Nov 13 '22 02:11

iossteps