Hiding NSTableView header?

浪尽此生 提交于 2019-11-29 04:30:02

问题


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


回答1:


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




回答2:


You can also set the headerView programmatically without subclassing

[tableView setHeaderView:nil];



回答3:


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


来源:https://stackoverflow.com/questions/3514210/hiding-nstableview-header

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!