krb
krb

Reputation: 16315

Hiding NSTableView header?

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

Upvotes: 56

Views: 14096

Answers (4)

iossteps
iossteps

Reputation: 111

Swift 5

tableView.headerView = nil

Upvotes: 2

Brian Webster
Brian Webster

Reputation: 12045

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

Upvotes: 105

finnsson
finnsson

Reputation: 4067

You can also set the headerView programmatically without subclassing

[tableView setHeaderView:nil];

Upvotes: 43

Scott Harwell
Scott Harwell

Reputation: 7465

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

Upvotes: 8

Related Questions