如何获取 NSOutlineView 中的总行数?
最佳答案
有一个名为 numberOfRows 的方法,它返回一个 NSInteger。 例如你的NSOutlineView被称为outlineView:
NSInteger *rows = [outlineView numberOfRows];
此处的文档:
https://developer.apple.com/documentation/appkit/nstableview/
“通常,您不应该询问 TableView 有多少行;相反,您应该询问 TableView 的数据源。”
如果你真的坚持使用tableView,有一个非正式的协议(protocol),那就是:
– numberOfRowsInTableView: (NSTableDataSource informal protocol)
关于objective-c - 获取 NSOutlineView 中的行数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1936291/