简体   繁体   English

扩展NSTableView

[英]Extended NSTableView

I would like to make a table-view with expanding ability. 我想制作一个具有扩展功能的表格视图。 When you press a row, the row should expand to show options like delete, copy and so on. 当您按一行时,该行应展开以显示诸如删除,复制等选项。 I have found an example for iOS, but I didn't get it running on Mac OS X, because NSTableView and UITableView are very different. 我找到了一个适用于iOS的示例,但是我没有让它在Mac OS X上运行,因为NSTableViewUITableView有很大不同。

http://www.cocoacontrols.com/platforms/ios/controls/kofiles http://www.cocoacontrols.com/platforms/ios/controls/kofiles

Has anyone another template? 还有其他模板吗? Or maybe even get this example running on Mac OS X? 或者甚至可以使该示例在Mac OS X上运行?

I don't have code to hand you but you can use a view-based NSTableView. 我没有代码可交给您,但是您可以使用基于视图的NSTableView。 Your prototype view can resize itself to include controls if it's selected. 您的原型视图可以调整自身大小以包含控件(如果已选中)。 All that's a bit complex to condense into a reasonably brief answer but if you use a view-based table view and treat the prototype view like any other that would grow and show extra controls, then wire this behavior to the selection state, it should work. 要压缩成一个合理的简短答案,这有点复杂,但是如果您使用基于视图的表视图并将原型视图与其他任何会增长并显示额外控件的视图一样对待,然后将此行为关联到选择状态,则它应该可以工作。

Note: you will have to write some code for the expansion portion, to handle resizing it, showing the controls, and notifying the table view that one of its rows changed height. 注意:您必须为扩展部分编写一些代码,以处理其大小调整,显示控件并通知表视图其行之一更改了高度。 Lots of documentation and examples exist out there for each individual component of your problem. 针对您的问题的每个单独组成部分,都有许多文档和示例。 Post more specific questions as you run into roadblocks. 遇到障碍时,请发布更具体的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM