开发者

Hiding NSTableView header?

开发者 https://www.devze.com 2023-01-12 07:13 出处:网络
How do I hid开发者_Python百科e an NSTableView header completely, so that it does not take any space up?In Interface Builder, select the table view, open the attributes inspector (alt-command-4), and u

How do I hid开发者_Python百科e an NSTableView header completely, so that it does not take any space up?


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


You can also set the headerView programmatically without subclassing

[tableView setHeaderView:nil];


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


Swift 5

tableView.headerView = nil
0

精彩评论

暂无评论...
验证码 换一张
取 消