关于自动表列标识符 [英] About the automatic table column identifier
问题描述
我在视图中创建了一个NSTableView和2个NSTableColumn。
I have create a NSTableView and 2 NSTableColumn in the view. Both of the identifiers of these 2 NSTableColumn set to "Automatic" in Interface Builder.
在方法中:
(NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
我使用
NSLog(@"%@", [tableColumn identifier])
检查这两个NSTableColumn的标识符。
to check the identifier of these 2 NSTableColumn.
我发现第一列的标识符是 AutomaticTableColumnIdentifier.0
,但第二个是(null)
。
I found the identifier of the first column is AutomaticTableColumnIdentifier.0
but the second is (null)
.
有没有理由第二列没有标识符?
Is there any reason that the second column doesn't have a identifier?
NSTableView的属性Columns为1,并将其增加到2,因此第一列包含在NSTableView中,但第二列不包括在内。
I have reduced the attribute "Columns" of NSTableView to 1 and increased it to 2 later, so the first column is included in the NSTableView but the second is not.
推荐答案
这可能是原因:
This is likely the reason:
我已经将NSTableView的属性Columns减少为1,
I have reduced the attribute "Columns" of NSTableView to 1 and increased it to 2 later, so the first column is included in the NSTableView but the second is not.
如果这会导致问题,请将标识符设置为nib。
If it's causing you problems, set the identifiers in the nib.
这篇关于关于自动表列标识符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!