仅显示“Table View Cell”的NSTableView [英] NSTableView only displaying "Table View Cell"
问题描述
我有一个NSTableView与委托和数据源指向我的控制器。我试过实现
- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn行方法,但无论我返回什么,该表始终显示Table View Cell(表视图单元格)在数据中。任何想法我可以做错了什么?附加的两个图片显示我已正确设置了代理(它也显示正确的行数)。
请注意,我也只是尝试返回 @Hello World
解决方案只需将内容模式
更改为 Cell Based
用于IB中的表视图。 IB将显示 Text Cell
作为单元格占位符,在运行时通过从返回的任何内容填充tableView:objectValueForTableColumn:row:
I have a NSTableView with the delegate and datasource pointing to my controller. I have tried implementing the
- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
Method, but no matter what I return, the table always shows "Table View Cell" in the data. Any ideas of what I could be doing wrong? Attached are two pics showing that I have the delegates set properly (it also shows the proper number of rows).
Note that I have also just tried returning @"Hello World"
for everything, but I get the same result.
解决方案 Just change the Content Mode
to Cell Based
for the table view in IB. IB will display Text Cell
as the cell placeholders, which are populated at runtime by whatever you return from tableView:objectValueForTableColumn:row:
这篇关于仅显示“Table View Cell”的NSTableView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!