It seems that NSTableView
has no equivalent to UITableView
's tableFooterView
property. What is the preferred way to add a footer view to a table view in Cocoa?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
NSTableView doesn't have sections like UITableView or NSCollectionView, and therefore no headers and footers.
Instead you can do it via your datasource, if you are using a view-based table.
- Add a cell to your table in Interface Builder with custom styling/elements that you need in your footer. Give it an identifier like "TableFooter"
- Increment (by one) the number of rows returned by your NSTableViewDataSource's
numberOfRowsInTableView(tableView:)
- and in
tableView(tableView:viewForTableColumn:row:)
for this last row, instantiate that item from storyboard using the identifier "TableFooter".