Hiding NSTableView header?

后端 未结 4 706
星月不相逢
星月不相逢 2020-12-29 00:46

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

相关标签:
4条回答
  • 2020-12-29 01:36

    Swift 5

    tableView.headerView = nil
    
    0 讨论(0)
  • 2020-12-29 01:39

    You can also set the headerView programmatically without subclassing

    [tableView setHeaderView:nil];
    
    0 讨论(0)
  • 2020-12-29 01:46

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

    0 讨论(0)
  • 2020-12-29 01:51

    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
    
    0 讨论(0)
提交回复
热议问题