Hiding NSTableView header?

Objective CCocoaNstableview

Objective C Problem Overview


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

Objective C Solutions


Solution 1 - Objective C

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

Solution 2 - Objective C

You can also set the headerView programmatically without subclassing

[tableView setHeaderView:nil];
	

Solution 3 - Objective C

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

Solution 4 - Objective C

Swift 5

tableView.headerView = nil

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionKristina BrooksView Question on Stackoverflow
Solution 1 - Objective CBrian WebsterView Answer on Stackoverflow
Solution 2 - Objective CfinnssonView Answer on Stackoverflow
Solution 3 - Objective CScott HarwellView Answer on Stackoverflow
Solution 4 - Objective CiosstepsView Answer on Stackoverflow