How do I hide an NSTableView header completely, so that it does not take any space up?
Asked
Active
Viewed 1.4k times
54
-
+1 for asking a good question. – ArtOfWarfare Dec 02 '12 at 22:50
4 Answers
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
-
-
Works also for `NSOutlineView`, obviously (Table View section of the attributes inspector). – Nicolas Miari Aug 20 '17 at 12:46
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